Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
f0c217cf
Commit
f0c217cf
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Improved documentation and include lists in the new files.
parent
d3c7a82e
No related branches found
No related tags found
1 merge request
!143
Gravity particles
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/physical_constants.c
+16
-4
16 additions, 4 deletions
src/physical_constants.c
src/physical_constants.h
+8
-1
8 additions, 1 deletion
src/physical_constants.h
src/potentials.c
+31
-2
31 additions, 2 deletions
src/potentials.c
src/potentials.h
+24
-2
24 additions, 2 deletions
src/potentials.h
with
79 additions
and
9 deletions
src/physical_constants.c
+
16
−
4
View file @
f0c217cf
...
@@ -18,13 +18,25 @@
...
@@ -18,13 +18,25 @@
*
*
******************************************************************************/
******************************************************************************/
#include
"physical_constants_cgs.h"
/* Config parameters. */
#include
"../config.h"
/* This object's header. */
#include
"physical_constants.h"
#include
"physical_constants.h"
/* Local headers. */
#include
"physical_constants_cgs.h"
/**
* @brief Converts physical constants to the internal unit system
*
* @param us The current internal system of units.
* @param internal_const The physical constants to initialize.
*/
void
initPhysicalConstants
(
struct
UnitSystem
*
us
,
void
initPhysicalConstants
(
struct
UnitSystem
*
us
,
struct
phys_const
*
prog_const
)
{
struct
phys_const
*
internal_const
)
{
float
dimension
[
5
]
=
{
1
,
-
3
,
2
,
0
,
0
};
prog_const
->
newton_gravity
=
const
float
dimension
[
5
]
=
{
1
,
-
3
,
2
,
0
,
0
};
internal_const
->
newton_gravity
=
NEWTON_GRAVITY_CGS
*
generalConversionFactor
(
us
,
dimension
);
NEWTON_GRAVITY_CGS
*
generalConversionFactor
(
us
,
dimension
);
}
}
This diff is collapsed.
Click to expand it.
src/physical_constants.h
+
8
−
1
View file @
f0c217cf
...
@@ -20,6 +20,10 @@
...
@@ -20,6 +20,10 @@
#ifndef SWIFT_PHYSICAL_CONSTANTS_H
#ifndef SWIFT_PHYSICAL_CONSTANTS_H
#define SWIFT_PHYSICAL_CONSTANTS_H
#define SWIFT_PHYSICAL_CONSTANTS_H
/* Config parameters. */
#include
"../config.h"
/* Local includes. */
#include
"units.h"
#include
"units.h"
/* physical constants in in defined programme units */
/* physical constants in in defined programme units */
...
@@ -29,8 +33,11 @@ struct phys_const {
...
@@ -29,8 +33,11 @@ struct phys_const {
/**
/**
* @brief Converts physical constants to the internal unit system
* @brief Converts physical constants to the internal unit system
*
* @param us The current internal system of units.
* @param internal_const The physical constants to initialize.
*/
*/
void
initPhysicalConstants
(
struct
UnitSystem
*
us
,
void
initPhysicalConstants
(
struct
UnitSystem
*
us
,
struct
phys_const
*
prog
_const
);
struct
phys_const
*
internal
_const
);
#endif
/* SWIFT_PHYSICAL_CONSTANTS_H */
#endif
/* SWIFT_PHYSICAL_CONSTANTS_H */
This diff is collapsed.
Click to expand it.
src/potentials.c
+
31
−
2
View file @
f0c217cf
#include
"units.h"
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2016 Tom Theuns (tom.theuns@durham.ac.uk)
* Matthieu Schaller (matthieu.schaller@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
/* Config parameters. */
#include
"../config.h"
/* This object's header. */
#include
"potentials.h"
#include
"potentials.h"
#include
"physical_constants.h"
/**
* @brief Initialises the external potential properties in the internal system
* of units.
*
* @param us The current internal system of units
* @param potential The external potential properties to initialize
*/
void
initPotentialProperties
(
struct
UnitSystem
*
us
,
void
initPotentialProperties
(
struct
UnitSystem
*
us
,
struct
external_potential
*
potential
)
{
struct
external_potential
*
potential
)
{
potential
->
point_mass
.
x
=
potential
->
point_mass
.
x
=
...
...
This diff is collapsed.
Click to expand it.
src/potentials.h
+
24
−
2
View file @
f0c217cf
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2016 Tom Theuns (tom.theuns@durham.ac.uk)
* Matthieu Schaller (matthieu.schaller@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_POTENTIALS_H
#ifndef SWIFT_POTENTIALS_H
#define SWIFT_POTENTIALS_H
#define SWIFT_POTENTIALS_H
/* Config parameters. */
#include
"../config.h"
/* Local includes. */
#include
"physical_constants_cgs.h"
#include
"physical_constants_cgs.h"
#include
"physical_constants.h"
#include
"physical_constants.h"
#include
"units.h"
#include
"units.h"
...
@@ -22,7 +46,6 @@ struct external_potential {
...
@@ -22,7 +46,6 @@ struct external_potential {
#define External_Potential_Mass \
#define External_Potential_Mass \
(1e10 * SOLAR_MASS_IN_CGS / const_unit_mass_in_cgs)
(1e10 * SOLAR_MASS_IN_CGS / const_unit_mass_in_cgs)
/**
/**
* @brief Computes the time-step due to the acceleration from a point mass
* @brief Computes the time-step due to the acceleration from a point mass
*
*
...
@@ -55,7 +78,6 @@ __attribute__((always_inline))
...
@@ -55,7 +78,6 @@ __attribute__((always_inline))
return
0
.
03
f
*
sqrtf
(
a_2
/
dota_2
);
return
0
.
03
f
*
sqrtf
(
a_2
/
dota_2
);
}
}
/**
/**
* @brief Computes the gravitational acceleration of a particle due to a point
* @brief Computes the gravitational acceleration of a particle due to a point
* mass
* mass
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment