How To Set Up A 2D CFD Case in Ls-Dyna: Marcus Timgren Dynamore Nordic

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

How to set up a 2D CFD case in LS-DYNA

Marcus Timgren
DYNAmore Nordic
Upcoming webex
■ The following Webex about the ICFD solver are scheduled.
■ How to set up a 2D FSI case in LS-DYNA
■ Jan 23
■ How to set up a 3D CFD case in LS-DYNA
■ Feb 7
■ How to set up a 3D FSI case in LS-DYNA
■ Feb 28
■ Difference between weak and strong coupling in FSI simulations in LS-DYNA
■ Mars 7
■ CFD Mesh controls in LS-DYNA
■ Mars 21
■ How to model conjugate heat transfer in LS-DYNA
■ April 4
■ How to model flow through porous media in LS-DYNA
■ April 25
■ Coupling between DEM particles and ICFD solver
■ Maj 16
■ How to model sloshing using the ICFD solver
■ Maj 23
Agenda CFD in LS-DYNA
■ Intro to the ICFD solver in LS-DYNA
■ Model intro
■ Mesh generation
■ Part and fluid properties
■ Boundary conditions
■ Control cards
■ Mesh cards
■ Output results
■ Run the model
■ Results
Intro to the ICFD solver in LS-DYNA
■ An implicit solver that uses double precision and is available from version
R7.0.
■ Supports both 2D and 3D calculations.
■ Has dynamic memory handling.
■ Works both for SMP, (no scalability in SMP), and MPP.
■ Can be coupled to the structural solver, the thermal solver, discrete element
method, and the Electromagnetic solver (EM).
■ Has two new sets of keywords *ICFD and *MESH.
■ Only a transient solver at the moment, steady state is under development.
■ Uses the Finite element method (FEM).
Intro to the ICFD solver in LS-DYNA

■ The solver has an automatic volume


mesher with an option to create a
boundary layer mesh.

■ The only input needed is the


surface mesh.

■ It is also possible to use a


predefined volume mesh, (only
tetra/triangles elements supported
in 3D/2D).

Model created by BETA CAE systems


Model intro Δx=15
■ Flow over a cylinder
■ The domain is a rectangle with a circle
that the fluid flows over, see picture.
■ The units are dimension less since a D=0.5
Reynolds number of 100 is used. Part 4:
■ The model will have four boundary Δy=10 Cylinder wall
Part 2:
conditions.
(4,5,0) Outlet
■ Inlet
■ Outlet Part 1: Inlet
■ Free-slip
■ No-slip
■ Fluid properties
■ Density is set to 1.
Part 3: Domain boundaries
■ Dynamic viscosity is set to 0.005.
■ Remember the Reynolds number:
𝐷𝑈𝜌 0.5∗1∗1
■ 𝑅𝑒𝐷 = = = 100
𝜇 0.005
■ The complete model can be downloaded
at:
http://www.dynaexamples.com/icfd/basi
cs-examples/cylinder_flow.
Mesh generation
■ In this presentation LS-PrePost will be used.
■ Recommended version for CFD 4.3 or a higher version.
■ Using the automatic mesher.
■ Create your domain boundaries and mesh them by beam elements, remember to create
the geometry in the x-y plane.
■ Create one separate PID for each boundary condition that you will use.
■ Check that no duplicated nodes exists and that the boundaries are connected.
■ If using a different pre-processor than LS-PrePost output the mesh in LS-DYNA format.
■ At the moment Primer and LS-PrePost are the only pre-processors that support the ICFD
solver keywords.
■ If you want to mesh and create the geometry in LS-PrePost follow these steps.
■ Use the 2D Mesh Generation in LS-PrePost.
■ Click on Mesh and then 2DMesh, now you will get a popup window where you can create
the geometry.
Mesh generation
■ The 2D Mesh Generator
■ Creating the boundaries.
1. In the toolbar to the right press the line tool.
2. Select KeyIn to enter coordinates for the inlet line, the lower
left corner has the coordinates (0,0) in the picture below.
3. Enter the coordinates for the first line and press Create.
4. Then change the x-coordinate to 15 and press Create.
5. Now change to the Pick mode and connect the two
boundaries in the graphical window.
Mesh generation
■ The 2D Mesh Generator
■ Creating the circle.
1. Press the circle tool in the toolbar.
2. Select KeyIn and enter the coordinates (4,5).
3. Click the Radius option and enter 0.25.
4. Then press create and if the geometry looks like the picture
below you can press exit to leave the 2D Mesher.
Mesh generation
■ Convert the curves to beam elements.
1. To create the beam elements press Mesh/EleGen.
2. Select Beam in the Element Generation popup.
3. Change ‘Beam By:’ to Curve.
4. Select Num and enter 10 then select Part 1. Now press Create
and the Accept.
5. Do the same for part 2 but change the Part ID to 2.
6. For Part 3 change the Num value to 15, remember to change
the Part ID.
7. For the circle part change to Size and enter 0.01, use Part ID
4.
8. Check for duplicate nodes and merge them by using
EleTol/DupNod then save the mesh as a keyword file called
mesh.k.
Mesh generation
■ Convert the mesh to a ICFD mesh.
■ First option is to use a text editor and change *ELEMENT_BEAM and *NODE to
*MESH_SURFACE_ELEMENT and *MESH_SURFACE_NODE respectively.
■ The second option is to use LS-PrePost:
■ Click on Mesh/MSMesh
■ In the Sel. Parts window select all parts.
■ In the MSMesh window set Starting
PID/EID/NID to one.
■ Then press Apply and if the model is
highlighted press Accept.
■ Now save the mesh in a file called
mesh.k.
Mesh generation
■ The solver generates the following mesh from the beam mesh.
■ As you can see it is a coarse mesh.
■ If you want to use this case to compare to other results it is recommended to use a finer
mesh, especially for the outer boundaries.
Parts and fluid properties
■ The first keyword is the *ICFD_SECTION.
■ A good practise is to have one file for the mesh and one file for all other ICFD keywords.
■ Start by including the mesh.k file by using *INCLUDE and then save the model as
main_fluid.k for example.
■ Then close LSPP and open the new file you created, now you will see the mesh.
■ To add *ICFD_SECTION click on Model/Keywrd and then make sure that All is marked in
the Keyword Manager. Then go to ICFD and select SECTION, at the moment this keyword
do not do anything but it must be defined so just click Accept and Done.
Parts and fluid properties
■ The next keyword is *ICFD_MAT
■ Double click on MAT under the ICFD family.
■ This keyword controls the fluid properties.
■ Set the density to one, the parameter RO,
and then set the dynamic viscosity to
0.005,
the parameter VIS.
■ Then modify the ICFD_PART keyword.
■ This keyword is automatically created
when opening a ICFD mesh if it do not exist
already.
■ Check that the SECID and MID has the same
ID´s as the created ICFD_MAT and
ICFD_SECTION keyword.
■ Do this for all parts and remember to press
Accept before changing to the next part.
Parts and fluid properties
■ ICFD_PART_VOL is used to associate
the fluid properties with the fluid
volume.
■ Now click on PART_VOL under the ICFD
family in the Keyword Manager.
■ Make sure that your are in the right
Subsys, look below the Delete button, if
not press Setting and select the file
main_fluid.k or the filename you used.
■ Select the section and material id that we
created before.
■ Then select all parts that enclose the fluid
volume, parts 1-4 in this case and press
Insert followed by Accept.
Boundary conditions
■ Prescribed velocity
■ Part 1
■ No-slip
■ Part 4
■ Free-slip
■ Part 3
■ Prescribed pressure
Part 4: Cylinder
■ Part 2 wall Part 2: Outlet

Part 1: Inlet

Part 3: Domain boundaries


Boundary conditions
■ Load curve for the inlet and outlet.
■ First create a load curve by clicking on
DEFINE and then CURVE in the Keyword
Manager.
■ Create a curve with a constant value of 1
by setting O1 to one for time zero and
press insert, do the same for A1 value of
10000.
■ Then press Accept and press NewID to
create a similar curve but with a constant
value of zero.
■ Inlet prescribed velocity.
■ Double click on
BOUNDARY_PRESCRIBED_VEL under ICFD in
the Keyword Manager.
■ Set DOF to 1, the x-direction, and VAD to
1, a linear profile, then select LCID 1. Next
press Insert and accept then press NewID
and set the y-direction to 0, use load curve
2.
Boundary conditions
■ A zero pressure outlet condition.
■ Find *ICFD_BOUNDARY_PRESCRIBED_PRE in
the Keyword Manager and select PID 2. Use
the load curve with a constant value of
zero, LCID 2.
■ Then press Insert and Accept.
■ No-slip condition for the circle.
■ The velocity at a wall surface with friction
is zero, to get that the keyword
ICFD_BOUNDARY_NONSLIP is used.
■ Select the part id 4 which is the circle and
press Insert. Then press accept and Done.
■ Free-slip condition for the boundaries
of the fluid domain.
■ Locate the keyword
ICFD_BOUNDARY_FREESLIP and use PID 3.
■ This boundary condition allow the fluid to
have a velocity along the boundary, used
for far field boundaries.
Control cards
■ To control the time step and end time
the keyword *ICFD_CONTROL_TIME is
used.
■ Set the end time to 100, the parameter
TTM and keep the remaining parameters as
default.
■ The time step will automatically be
calculated by the solver based on the CFL
criterion.
■ Another good keyword to use is
*ICFD_CONTROL_OUTPUT.
■ It can output the fluid volume mesh and
the results in another format than d3plot,
for example in a Paraview format.
■ It also controls the message level details
from the solver that are printed in the
terminal and message files.
Mesh cards
■ To generate the fluid volume mesh the
keyword *MESH_VOLUME is used.
■ Locate the keyword under MESH in the
Keyword Manager.
■ Select all parts that encloses the fluid
volume and press Insert. Then press Accept
and Done.
■ To generate the boundary layer mesh
the keyword *MESH_BL is used.
■ Select which PID that will have a boundary
layer, in this case PID 4, then enter 2 in
the NELTH parameter.
■ This means that the element closest to the
surface will be divided two times and
generating three boundary layer elements.
■ Keep the remaining parameters as default
and press Insert and then Accept.
Output results
■ To output results the keyword
*DATABASE_BINARY_D3PLOT is used.
■ Locate the keyword under DATABASE and
double click on it.
■ Enter 1 in the DT parameter field this
means that you will get 100 result states
since the end time is 100.
■ Then press Accept and Done.
■ ICFD database keywords that are
useful for this case.
■ The *ICFD_DATABASE_DRAG outputs the
drag force on a given boundary, set PID 4 in
this case.
■ The *ICFD_DATABASE_TIMESTEP outputs a
file called icfd_tsout.dat and outputs the
taken time steps and the CFL time step.
■ Save the model as a keyword file.
Run the model
■ You have to use a double precision version of LS-DYNA since the ICFD solver do
not exists in the single precision version.
■ I recommend to use R9.0.1 or higher LS-DYNA version.
■ For windows:
■ I recommend to use LS-RUN, can be downloaded for free from
https://ftp.dynamore.se/public/lsprepost/LS-Run/.
■ To get scalability use a MPP version since the SMP version do not have any scalability
implemented.
■ The ICFD solver uses dynamic memory so you could start it with 1M.
■ For Linux:
■ Our command looks like this:
■ mppdyna 4 ls-dyna_mpp_d_r9_0_1_109912_x64_redhat54_ifort131_sse2_platformmpi i=i.k
memory=1m
■ mppdyna is our script to run a mpp simulation.
■ Check the manual for more information.
■ LS-RUN works on Linux as well if you want to use it.
■ The model takes about 5 min on 1 CPU.
Results
■ To post-process the results I recommend to use LS-PrePost 4.3 or a higher
version.
■ When opening the d3plot file it will look like this in LS-PrePost 4.3.
■ The time is controlled by the Animate bar.
Results
■ The objects window determines the visibility of
the objects and it is also here that you create
more objects by right clicking on a object.
■ In a 2D simulation most of the interesting results
can be found on the MS_SHELL object.
■ The easiest way to present results is to change
the PID colour in the Display Options.
■ Select the Object MS_SHELL and then change the “Color
by” in the Display Option window to Fluid velocity.
■ If you scroll down in the Display Option window there
exists some control parameters for the fringe legend.
■ Create streamlines by right clicking on the
MS_SHELL object and choose Streamline.
Results
■ The source of the streamlines is controlled in the
Object Properties.
■ Click on P0 and select a point on the model or type the
coordinates, do the same for P1. The point P2 is not
used since the source is set to a line.
■ The number of lines is controlled by the NumXpt and set
it to 15 to start with.
■ As you can see in the Objects window the streamline has
a * in front of it which means that it needs to be
updated. Right click on the Streamline object and select
update, now you should see the streamlines if not check
that you have moved from state 1.
■ How the streamlines is presented is controlled under the
Display Options.
■ To plot results from a ICFD_DATABASE keyword
use the MS-Ascii button and load the correct
database.
■ This gives you an basic understanding of how to
post-process the results.
Results
■ Fluid velocity
Results
■ Drag force for the circle
■ Analytical formula for the drag force.
1
■ 𝐹𝐷 = 𝐶𝐷 𝐴 2 𝜌𝑈 2 where 𝐶𝐷 is the drag coefficient and can be set to 1.2 for a circle and laminar
flow.
■ When using the values from the simulation it gives a force of 0.1178 compared to force of 0.27
from the simulation.
■ The difference can be explained by the coarse mesh and the vortex shredding. For a benchmark
study of this case look at: ftp://ftp.lstc.com/outgoing/inaki/docs/pdf_icfd/Cylinder.pdf
Thank you!

Your LS-DYNA distributor and


more

You might also like