Gravity#

class Gravity[source]#

Bases: Flow360BaseModel

Gravity class for specifying gravitational body force.

The gravity model applies a body force ρg to the momentum equations and ρ(g·u) to the energy equation, enabling simulation of buoyancy-driven flows. Gravity is applied globally to all fluid zones in the simulation.

Example

Define gravity with Earth’s default values (direction=(0,0,-1), magnitude=9.81 m/s²):

>>> fl.Gravity()

Define gravity with custom direction and magnitude:

>>> fl.Gravity(
...     direction=(1, 0, 0),
...     magnitude=5.0 * fl.u.m / fl.u.s**2,
... )

Attributes

direction: Axis#

The direction of the gravitational acceleration vector.

Default:

(0, 0, -1)

magnitude: Any#

The magnitude of the gravitational acceleration. For Earth’s surface gravity, use 9.81 m/s².

Default:

9.81 * fl.u.m/fl.u.s**2

Additional Constructors

classmethod from_file(filename)#

Load a Flow360BaseModel from a .json file.

Parameters:

filename (str)

Return type:

Flow360BaseModel

Methods

help(methods=False)#

Print fields and methods of a Flow360BaseModel using rich.

Parameters:

methods (bool)

Return type:

None

to_file(filename, **kwargs)#

Export Flow360BaseModel instance to a .json file.

Parameters:
Return type:

None