Step-by-step guide
- Follow the installation guide to install OpenTerrace.
- Browse through the tutorials to get an idea of how to set up simulations.
- Then come back to this section to get more details on the individual steps.
Import OpenTerrace and define global parameters
Line 1: OpenTerrace is imported so we can access its functionsLine 2: Create an instance ot
and initialise with parameters that control our simulation. They include:
-
t_end
(required): End time of the simulation in seconds -
dt
(required): Time step size in seconds -
n_fluid
(optional): Number of discretisations for the fluid phase (omit if only solving the bed phase) -
n_bed
(optional): Number of discretisations for the bed phase (omit if only solving the fluid phase)
Note, either n_fluid
or n_bed
should be specified. If either is omitted that phase wont be simulated.
substance
(required): Name of substance for the phase we are defining
Alternatively, we may define a custom substance on-the-fly with a constant density, specific heat capacity and thermal conductivity by:
-
rho
(required): Density in kg/m^3 -
cp
(required): Specific heat capacity in J/(kg*K) -
k
(required): Thermal conductivity in W/(m*K)
2. Select a domain shape
domain
(required): Domain used for the phase
We choose a domain shape using on of the primivite shapes that come built into OpenTerrace. See this list for avialable shapes. Note, each domain will have additional parameters required, e.g. a sphere requires a radius to be defined. You will be prompted to add these if you are missing some.
3. Select a porosity (optional
)
phi
(required): Porosity m^3/m^3 (e.g. set to 0.4 and the fluid only occupies 40% of the volume)
The domain may be only partially filled with fluid as a bed phase occupies some space. This command may be omitted in which case the fluid occupies the whole domain.
4. Select discretisation schemes
-
diff
(required): Discretisation scheme for the diffusion term -
conv
(required): Discretisation scheme for the convective term
We choose how to discretise our diffusion and convective terms in our governing equations. A list of avialable schemes is avialable here diffusion schemes and convective schemes.
5. Select intial conditions
-
T
(required): Temperature in K -
mdot
(optional): mass flow rate in kg/s
We choose initial conditions for our simulation in terms of temperature and mass flow rate.
6. Select boundary conditions
-
bc_type
(required): Name of the boundary condition type -
parameter
(required): Parameter for which you are specifying boundary condition -
position
(required): Can be either(slice(None, None, None), 0)
for lower bc (e.g. 1d cylinder) or centre boundary (e.g. 1d sphere), or(slice(None, None, None), -1)
for upper bc (e.g. 1d cylinder) or surface boundary (e.g. 1d sphere). -
value
(required): Specifies the value fordirichlet
ordirichlet_timevarying
type bcs.
Setup the bed phase
The bed phase is setup in a similar fashion to the fluid phase. An example is given below:
Note we use neumann type bcs for both boundaries. The coupling between the phases is a source term, which will be added using the coupling
keyword next.
Define phase interactions and post-processing
-
h_coeff
(required): Correlation for the heat transfer coefficient (note currently onlyconstant
is available) -
h_value
(required): Heat transfer coefficient in W/(m^2*K)
-
save_int
(required): Save interval (number of time steps between two successive write outs) -
file_name
(optional): Specfies a filename for the animation
Finally, we define how to visualise the results. Here, we save results every 6000 timestep (dt=0.025 s) e.g. every 150 s.