0% found this document useful (0 votes)
68 views4 pages

Tesla Car Simulation Tutorial

The document provides details about a tutorial simulation of a simplified Tesla racing car using OpenFOAM. It describes the geometry, boundary conditions, and meshing approach. It also outlines the steps performed by the Allrun script to automatically run the simulation, including extracting surface features, generating the mesh, decomposing for parallel running, and post-processing. Potential areas for further investigation are suggested, such as changing the mesh resolution, performing a parallelization study, validating the results, and exploring different vehicle speeds and turbulence models.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views4 pages

Tesla Car Simulation Tutorial

The document provides details about a tutorial simulation of a simplified Tesla racing car using OpenFOAM. It describes the geometry, boundary conditions, and meshing approach. It also outlines the steps performed by the Allrun script to automatically run the simulation, including extracting surface features, generating the mesh, decomposing for parallel running, and post-processing. Potential areas for further investigation are suggested, such as changing the mesh resolution, performing a parallelization study, validating the results, and exploring different vehicle speeds and turbulence models.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Tutorial 10: Tesla Car

Learning Outcomes:
Basic setup for Tesla Car simulation.

X.1 Introduction
Automotive aerodynamics is a significant area of interest for CFD and one which has
driven much research in areas such as turbulence modelling. In this tutorial we will
examine a simulation of a simplified Tesla racing car. This is provided with an Allrun
file, which is an OpenFOAM script file (extensively used in the release tutorials) which
automates the process of running the case : type ./Allrun in the case directory and
it will automatically execute all the different OpenFOAM applications to complete the
simulation. However it is important to understand the different commands and what
they do. This tutorial serves as the starting point for your CFD miniproject; however
just submitting the results of running Allrun will not gain many marks; you are expected
to modify the case and use it to undertake a thorough investigation of both the CFD
and the results – some suggestions for directions to take with this are provided at the
end.

X.2 The Problem

Figure 1: Geometry of Tesla racing car. Note that the geometry is symmetric so only
1/2 the vehicle is actually simulated

The case files provide a basic setup for the Tesla car shown in figure 1. Given the
symmetry of the case, in fact only half the vehicle is being simulated, with a symmetry
plane down the centre of the car. The car is moving at a speed of 20 m/s, but the
simulation is performed in the frame of reference of the car (which is therefore stationary
whilst the inlet and ground are moving backwards at this speed). The wheels are at
X = 3.9m (back wheel) and X = 0.93m (front wheel) and are rotating at an appropriate
angular velocity not to slip on the road (this is defined in the U variable file). The side
and top are also defined as symmetry planes as this implements a zero gradient condition
at these places, which is a good way to specify an “open” domain for an outdoor vehicle.
Car Wheels
Length (X) 4.97 m Diameter 0.64 m
Height (Z) 1.28 m Front Wheel X = 0.93 m
Width (Y) 2.17 m Back Wheel X = 3.9 m
Wheelbase 2.97 m

X.3 Allrun
In this case the commands are
# !/ bin / sh
cd $ \{0% /* \} || exit 1 # run from this directory

# Source tutorial run functions


. $WM_PROJECT_DIR / bin / tools / RunFunctions

runApplication s u r f a c e F e a t u r e E x t r a c t

runApplication blockMesh

[ ! -d 0 ] && cp -r 0. orig 0

runApplication snappyHexMesh - overwrite

runApplication decomposePar

runParallel potentialFoam

runParallel $ ( getApplication )

runApplication rec on st ru ct Pa rM es h - constant

runApplication reconstructPar - latestTime

The main commands can be run separately (probably worth doing this at least once to
understand how this works) – runApplication and runParallel are OpenFOAM scripts
which run the commands singly or in parallel, respectively. The actual commands are
as follows :
surfaceFeatureExtract

Extracts the edges of the object from the .stl file – this can be used in snappyHexMesh
to improve the accuracy of the meshing around the edges.

blockMesh

Uses blockMesh to define a base rectangular block of cells which will be truncated by
snappyHexMesh to create the mesh.

[ ! -d 0 ] && cp -r [Link] 0

Copies the zero timestep directory into place (some Linux wizardry here).

snappyHexMesh -overwrite

Runs snappyHexMesh (based on the preprepared system/snappyHexMeshDict dictio-


nary) to do the meshing. The -overwrite flag indicates that all necessary information
is written back to the 0 timestep directory rather than creating separate directories for
each step of the process – so the files can be used instantly for the next stage.

decomposePar

The aim is to run the simulation in parallel on 4 processors – this command divides
the mesh and data files into 4 separate chunks (domain decomposition) as defined in
system/decomposeParDict, using a simple method called “Scotch”.

mpirun -np 4 potentialFoam -parallel

mpirun -np 4 simpleFoam -parallel

These commands run first potentialFoam (solves the velocity potential equation, which
is quite a good way of initialising an external aerodynamics solution) then simpleFoam,
both in parallel on 4 processors (possibly 4 cores, depending on your architecture). The
mpirun command is being dealt with in the Allrun file through the runParallel script,
but you need it here if you want to run the command on its own.

reconstructParMesh -constant

reconstructPar -latestTime

Finally, to postprocess the entire domain, we need to pull the individual mesh sections
back together – these commands reconstruct the mesh as a single entity and reassemble
all the datafields for the latest time step in the simulation (1000, here)
Running the Allrun script you will see that the output from each separate Open-
FOAM app gets placed in a log file [Link], where XXX is the name of the app. The log
file for simpleFoam can be analysed using the command

foamLog [Link]

which generates a directory logs containing files for all the separate residuals, which can
then be plotted.

As indicated, this is intended as a starting point for your own investigation of the CFD
and outputs for this case. Some suggestions for further investigation :

• What is the effect of changing (refining?) the mesh, on the solution? Ideally
you should look for mesh independence, where the solution does not change with
finer meshes – this may not be possible for this case, but you should experiment
with different meshing strategies; maybe even use Pointwise or another meshing
package.

• If you have a large mesh, you might like to try a parallelisation study – how does
the calculation time change when run on different numbers of processors?

• Has the calculation converged? Is it actually steady or would a transient solution


(pisoFoam) be better?

• Is the domain large enough/too large? How would you change it to be represen-
tative of a wind tunnel (say?)

• How can you validate the solution? What typical drag coefficient would you
expect for a Tesla car, and how does this compare? We do not have experimental
data for this case, but you might try a different case, such as the Ahmed body.

• Try different vehicle speeds – how do you expect the drag force to change? Don’t
forget to change the rotation speed of the wheels! How are the turbulence quan-
tities calculated at the inlet, and what happens if you change these?

• Is k −  the best turbulence model to use? Check y + values on the vehicle surfaces
to ensure the wall model is adequate.

• What information can you extract from the simulation, and what is the best way
to present it? Since you will be doing a poster/powerpoint or YouTube video,
you might want to put some effort into producing some good visualisations.

Common questions

Powered by AI

The key steps in setting up a Tesla car simulation in OpenFOAM involve using the Allrun script, which automates the execution of multiple OpenFOAM applications. The script includes commands like surfaceFeatureExtract, which extracts object edges from a .stl file for better mesh accuracy; blockMesh, which defines a base block of cells; snappyHexMesh with the -overwrite option to refine the mesh using a predefined dictionary; decomposePar to divide the computation across processors; potentialFoam and simpleFoam for solver execution, both run in parallel using mpirun; and reconstructParMesh and reconstructPar to consolidate the mesh and data fields after simulation, creating a unified dataset for postprocessing .

Mesh refinement in CFD studies generally increases simulation accuracy by providing a more detailed representation of the geometry and flow fields. For the Tesla car simulation, it is suggested to experiment with different meshing strategies to achieve mesh independence, where further refinement does not significantly alter results. However, achieving mesh independence may not always be possible, indicating the need to test different approaches or possibly use alternative meshing packages .

Parallel computing can significantly reduce the calculation time of large CFD simulations by distributing the workload through domain decomposition. In the Tesla car simulation, decomposing the problem into multiple domains allows each processor to handle a portion of the workload, leading to potentially faster results. A parallelisation study should be conducted to understand how time-to-solution scales with the number of processors, ensuring efficiency in resource usage and performance enhancement .

Effective presentation of CFD results for a Tesla car study can involve using contour plots, streamlines, and vector fields to visually depict aerodynamic flow patterns. Animations showing time-evolution of flow over the car can enhance understanding of transient effects. High-quality 3D renderings and cross-sectional views spotlight areas of interest like vortices or pressure variations. Use of software tools can integrate data and visuals into cohesive slide decks or videos, improving audience engagement and comprehension during presentations .

Validating CFD simulations without experimental data poses challenges in assessing the accuracy of the results. For automotive simulations like that of a Tesla car, one approach is to compare computed values such as the drag coefficient against typical values reported for similar vehicles. However, the lack of direct experimental comparison limits the ability to fully verify accuracy, necessitating careful choice of turbulence models and domain settings to increase confidence in the results. The exploration of alternative validation cases, such as using known data from an Ahmed body, may provide some benchmarking guidance .

The symmetry in the Tesla car geometry allows for only half of the vehicle to be simulated, reducing computational requirements. A symmetry plane is used along the center of the car, implementing a zero gradient condition on the side and top, effectively simulating an open domain environment for the vehicle. This reduction in the simulated domain not only saves computational resources but also simplifies the meshing and boundary conditions setup in the CFD application .

The size of the computational domain in a CFD study affects boundary condition interactions and the ability to capture flow phenomena accurately. For a Tesla car model, a domain that is too small could introduce artificial constraints on flow development, while an excessively large domain might increase computation times with marginal gains in result accuracy. The domain should be appropriately sized to accurately represent environmental conditions such as those of a wind tunnel, ensuring realistic simulation of vehicle aerodynamics .

Changing the vehicle speed in CFD simulations would directly impact the aerodynamic forces, including drag force. Higher speeds typically result in increased drag due to greater fluid resistance. When adjusting the Tesla car's speed, it is important to proportionally modify wheel rotation speeds to maintain physical consistency and accurately simulate non-slip conditions. Additionally, changes in vehicle speed may require recalibrating turbulence quantities at the inlet, affecting flow field simulations and overall aerodynamic predictions .

A transient solution might be preferred over a steady-state solution when simulating a Tesla car's aerodynamics if the flow conditions around the vehicle are inherently unsteady or if capturing dynamic fluid interactions and time-dependent phenomena is crucial. This approach could better model real-world driving scenarios, where factors like wind gusts and transient vehicle movements affect aerodynamic behavior. However, transient solutions often require more computational resources and time compared to steady-state approximations .

Turbulence models like k-ε are crucial in predicting turbulent flow behavior in CFD simulations, significantly influencing the accuracy of automotive aerodynamic predictions. The k-ε model is popular for its computational efficiency and reasonable accuracy across a range of flows. However, its suitability should be assessed using parameters like y+ values on vehicle surfaces to ensure the wall model's fitness. Further, validation against known benchmarks or different flow regimes helps ascertain the model's applicability, as no single turbulence model is universally optimal for all cases .

You might also like