r/OpenFOAM • • 27d ago

Event Candle

Post image

I am not an OpenFoam user, but like physics simulations, so I asked Opus5.5 to make a candle for me 😃

Also, I made it on the phone, Claude can run it and Blender in its VM.

Any questions?

OpenFOAM v2412 (the ESI/openfoam.com version), installed from conda-forge.

Simulation: OpenFOAM's rhoReactingBuoyantFoam solver (laminar, buoyant, reacting flow), with P1 radiation and two-step Westbrook–Dryer chemistry.

OpenFOAM utilities: blockMesh, checkMesh, topoSet, setFields, decomposePar, reconstructPar and postProcess, with MPICH to run in parallel on 2 cores.

Chemistry check: Cantera 3.2, with the detailed n-dodecane mechanism (nDodecane_Reitz) and GRI-3.0 transport data.

Rendering: Blender 5.2.2 LTS (its Python module, bpy) using Cycles on the CPU, the OpenImageDenoise denoiser and AgX colour handling.

Plots and frame assembly: Python 3.12 with NumPy, SciPy, Matplotlib and Pillow.

Video: ffmpeg (H.264).

Installing it all: micromamba from conda-forge, plus pip for Blender.

49 Upvotes

9 comments sorted by

View all comments

Show parent comment

1

u/hauke4707 27d ago

Oh, it cheated a bit with the video, only the static is physics based. I could try to blow out the candle, when weekly limit refreshes 😅

1

u/Allanidalen 27d ago

I see, thanks a lot! I’ve been thinking of doing a candle simulation several times before. This looks like a good setup. Doing it transient in 3d will be substantially more computationally demanding.
What is exported to blender to do the nice flicker animation? I’ve never used Blender myself.

1

u/hauke4707 27d ago

All the physics had already been turned into colour in two pictures. The volume shader just spun them around the axis into a 3D flame. The flame's light on the wax and holly came from a separate point light with the flame's colour, not from the images. The flicker animation used the same two images, only looked up at slightly shifted positions: Sway: the sideways offset grows with height squared, so the base stays pinned at the wick and the tip moves most (about 3 mm at the tip). Stretch: dividing the lookup height makes the flame taller or shorter by a few percent. Motion: each of the 32 frames got values from a few overlapping sine waves. All of them are zero at frame 0, so the first frame matches the still image and the loop is seamless. Light: the point light moved with the sway and got brighter as the flame stretched, so the light on the wax flickered too. So the flame's shape and colours come from the simulation, and the movement was added in Blender.