Electric fireplace three-dimensional dynamic flame simulation generation method and system
By acquiring the flame base region, mapping the temperature gradient and heat source intensity, calculating the heat flux intensity and direction vector, generating and optimizing particle motion trajectories that conform to the laws of fluid mechanics, the problem of low accuracy in existing flame dynamic simulation technology is solved, and high-precision and naturally random flame simulation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BOGE TECH CO LTD
- Filing Date
- 2026-04-02
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies struggle to accurately depict the combined effects of thermal and random forces on the movement of particles inside a flame in a 3D model, resulting in a lack of natural dynamism in the generated flame dynamics.
By acquiring the flame base region, mapping the temperature gradient distribution and heat source intensity, calculating the heat flux intensity and heat flux direction vector, and combining acceleration and disturbance components, particle motion trajectories that conform to the laws of fluid mechanics are generated, and trajectory optimization and texture generation are performed.
It achieves high-precision simulation of flame dynamics, enhancing the dynamism and visual coherence of flames, and incorporating natural random details and unpredictability.
Smart Images

Figure CN121962532A_ABST
Abstract
Description
A method and system for generating three-dimensional dynamic flame simulation of an electric fireplace Technical Field
[0001] This invention relates to the field of dynamic simulation technology, and in particular to a method and system for generating three-dimensional dynamic flame simulations of electric fireplaces. Background Technology
[0002] Currently, electric fireplace flame simulation requires the use of 3D models to generate dynamic flame sequences to enhance product immersion. However, due to the combined effects of thermal and random forces on the movement of particles inside the flame, existing simulation methods struggle to accurately depict such complex fluid details and random disturbance characteristics in 3D models. This results in a lack of natural dynamism in the generated flame dynamics. There is an urgent need for a 3D model that can incorporate physical randomness to drive particle movement, thereby generating dynamic flame sequences in 3D space that conform to the laws of fluid mechanics and possess natural random details.
[0003] In one existing technique, a particle system is constructed using computer graphics methods, and a pre-defined texture image is provided for each particle, along with its initial position and velocity. The basic motion rule is that the particles rise at a uniform speed vertically and are superimposed with a sinusoidal undulating trajectory horizontally. Each frame, when updating the particle position, a random offset is generated using a random number generator and superimposed on the particle's velocity or position to simulate the random perturbation characteristics of flames. The textures of all particles are rendered and composited according to their current coordinates to generate a single frame of flame image. This process is repeated to obtain a continuous sequence of dynamic flames. However, this existing technique uses simplified motion rules and random number superposition to simulate flames, resulting in mechanically repetitive flame dynamics that lack natural dynamism.
[0004] Therefore, existing technologies suffer from low accuracy in dynamic flame simulation. Summary of the Invention
[0005] This invention provides a method and system for generating three-dimensional dynamic flame simulation of an electric fireplace, so as to achieve high-precision simulation of flame dynamics.
[0006] Firstly, in order to solve the above-mentioned technical problems, the present invention provides a method for generating a three-dimensional dynamic flame simulation of an electric fireplace, comprising:
[0007] Obtain the flame base region;
[0008] Based on the flame base region, the initial temperature gradient is solved to obtain the temperature gradient distribution, and the heat source intensity is mapped based on the temperature gradient distribution to obtain the heat source intensity distribution.
[0009] Based on the temperature gradient distribution and the heat source intensity distribution, the heat flux intensity is solved to obtain the local heat flux intensity, and based on the local heat flux intensity, the heat flux direction vector is filtered to obtain the initial heat driving vector;
[0010] Based on the initial thermal driving vector, the temperature field is iteratively calculated to obtain a thermal driving vector sequence, and the acceleration is weighted and calculated based on the thermal driving vector sequence to obtain the final acceleration.
[0011] Based on the final acceleration, the disturbance components are superimposed to obtain a hybrid thermal driving vector, and spatial displacement is calculated based on the hybrid thermal driving vector to obtain the actual trajectory sequence.
[0012] Based on the actual trajectory sequence and the temperature gradient distribution, displacement correction is performed to generate a continuous path sequence. Based on the continuous path sequence, anomaly identification is performed based on curvature judgment to obtain the abnormal path.
[0013] Based on the continuous path sequence, the velocity is solved to obtain the initial velocity sequence, and the variance of the initial velocity sequence is calculated to obtain the inter-frame continuity result.
[0014] Based on the abnormal path and the inter-frame continuity result, coordinate interpolation correction is performed to obtain a corrected trajectory sequence, and trajectory smoothing is performed based on the corrected trajectory sequence to obtain an optimized trajectory sequence.
[0015] Based on the optimized trajectory sequence, the heat source influence area is filtered to obtain the area to be rendered, and a three-dimensional texture is generated based on the area to be rendered to obtain the flame texture output.
[0016] Secondly, the present invention provides a three-dimensional dynamic flame simulation generation system for electric fireplaces, comprising:
[0017] The data acquisition module is used to acquire the flame base region;
[0018] The mapping module is used to solve for the initial temperature gradient based on the flame base region to obtain the temperature gradient distribution, and to map the heat source intensity based on the temperature gradient distribution to obtain the heat source intensity distribution.
[0019] The filtering module is used to solve for the heat flux intensity based on the temperature gradient distribution and the heat source intensity distribution, to obtain the local heat flux intensity, and to filter the heat flux direction vector based on the local heat flux intensity to obtain the initial heat driving vector.
[0020] The calculation module is used to perform iterative calculation of the temperature field based on the initial thermal driving vector to obtain a thermal driving vector sequence, and to perform acceleration weighted calculation based on the thermal driving vector sequence to obtain the final acceleration;
[0021] The superposition module is used to superimpose the disturbance components according to the final acceleration to obtain a mixed thermal driving vector, and to calculate the spatial displacement according to the mixed thermal driving vector to obtain the actual trajectory sequence.
[0022] The identification module is used to perform displacement correction based on the actual trajectory sequence and the temperature gradient distribution, generate a continuous path sequence, and perform anomaly identification based on curvature judgment based on the continuous path sequence to obtain an abnormal path.
[0023] The continuity module is used to solve for the velocity based on the continuous path sequence, obtain an initial velocity sequence, calculate the variance of the initial velocity sequence, and obtain the inter-frame continuity result.
[0024] The smoothing module is used to perform coordinate interpolation correction based on the abnormal path and the inter-frame continuity result to obtain a corrected trajectory sequence, and to perform trajectory smoothing based on the corrected trajectory sequence to obtain an optimized trajectory sequence.
[0025] The output module is used to filter the heat source influence area according to the optimized trajectory sequence, obtain the area to be rendered, and generate a three-dimensional texture according to the area to be rendered to obtain the flame texture output.
[0026] Compared with the prior art, the present invention has the following beneficial effects:
[0027] (1) The present invention calculates the heat transfer rate by numerical calculation and weighted summation of heat conduction based on temperature gradient distribution and heat source intensity distribution, solves the local heat flow intensity by boundary heat flow rules and calculates the heat flow direction vector field by heat flow gradient calculation, and filters the initial heat driving vector by combining preset angle range and modulus threshold, so as to realize the accurate extraction and orientation of heat driving force and provide a dynamic basis for particle motion that conforms to the laws of fluid mechanics.
[0028] (2) The present invention makes a threshold judgment based on the final acceleration and introduces random disturbance components. It obtains a mixed thermal driving vector by vector superposition and calculates the actual trajectory sequence by spatial displacement. While following the physical laws, it incorporates controlled randomness, so that the particle motion trajectory has both fluid dynamics characteristics and natural random details, enhancing the agility and unpredictability of flame dynamics.
[0029] (3) Based on the inter-frame continuity results, the present invention detects abnormal paths with insufficient continuity, extracts their spatial coordinate points and calculates displacement vectors to obtain motion vector fields, selects regions with modulus exceeding the threshold as regions to be corrected, supplements coordinates through linear interpolation algorithm to obtain corrected trajectory sequences, and then uses weighted moving average method to smooth them, thereby realizing adaptive correction and optimization of the trajectory and improving the visual coherence of the flame dynamic sequence. Attached Figure Description
[0030] Figure 1 is a schematic flowchart of the three-dimensional dynamic flame simulation generation method for an electric fireplace provided in the first embodiment of the present invention;
[0031] Figure 2 is a schematic diagram of the structure of the three-dimensional dynamic flame simulation generation system for electric fireplaces provided in the second embodiment of the present invention. Detailed Implementation
[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0033] Referring to Figure 1, the first embodiment of the present invention provides a method for generating a three-dimensional dynamic flame simulation of an electric fireplace, comprising the following steps:
[0034] S11, Obtain the flame base region;
[0035] S12, Based on the flame base region, perform initial temperature gradient calculation to obtain temperature gradient distribution, and perform heat source intensity mapping based on the temperature gradient distribution to obtain heat source intensity distribution;
[0036] S13, based on the temperature gradient distribution and the heat source intensity distribution, the heat flux intensity is solved to obtain the local heat flux intensity, and based on the local heat flux intensity, the heat flux direction vector is filtered to obtain the initial heat driving vector;
[0037] S14. Based on the initial thermal driving vector, perform iterative calculation of the temperature field to obtain a thermal driving vector sequence, and perform acceleration weighted calculation based on the thermal driving vector sequence to obtain the final acceleration.
[0038] S15, based on the final acceleration, the disturbance components are superimposed to obtain a hybrid thermal driving vector, and spatial displacement is calculated based on the hybrid thermal driving vector to obtain the actual trajectory sequence;
[0039] S16, Based on the actual trajectory sequence and the temperature gradient distribution, perform displacement correction to generate a continuous path sequence, and based on the continuous path sequence, perform anomaly identification based on curvature judgment to obtain an abnormal path;
[0040] S17. Based on the continuous path sequence, the velocity is solved to obtain the initial velocity sequence, and the variance of the initial velocity sequence is calculated to obtain the inter-frame continuity result.
[0041] S18, based on the abnormal path and the inter-frame continuity result, perform coordinate interpolation correction to obtain a corrected trajectory sequence, and perform trajectory smoothing based on the corrected trajectory sequence to obtain an optimized trajectory sequence;
[0042] S19, based on the optimized trajectory sequence, the heat source influence area is filtered to obtain the area to be rendered, and a three-dimensional texture is generated based on the area to be rendered to obtain the flame texture output.
[0043] In step S11, the flame base region is obtained.
[0044] Specifically, the flame base region is acquired. This region serves as the spatial boundary for all subsequent simulation calculations, and its data originates from pre-stored simulation configuration files or coordinate parameters input by the user through an interactive interface. The flame base region is specifically represented as a rectangular cube in three-dimensional space, defined by six coordinate values: minimum and maximum values along the x-axis, y-axis, and z-axis. These coordinate values are set according to the actual dimensions of the electric fireplace and simulation requirements; for example, the x-axis corresponds to the width of the furnace, the y-axis to the depth, and the z-axis to the height. After acquiring the flame base region, it is passed as a global variable to subsequent steps to constrain the construction of the discretized mesh, the boundary constraints of particle motion, and the clipping of the rendering area. This ensures that the entire simulation process is conducted within physical space, avoiding wasted computational resources and boundary overflow. This step does not involve complex mathematical operations; it is completed solely through data reading or receiving operations, and its output variable is the flame base region.
[0045] In step S12, based on the flame base region, an initial temperature gradient is calculated to obtain a temperature gradient distribution, and a heat source intensity mapping is performed based on the temperature gradient distribution to obtain a heat source intensity distribution, including:
[0046] Based on the preset spatial range and preset grid size, the flame base region is discretized using the finite difference method to construct a discretized grid region. An initial temperature value is then assigned to the discretized grid region according to a pre-constructed initial temperature distribution rule to obtain the initial temperature field.
[0047] Based on the initial temperature field and the grid size, the temperature gradient is calculated to obtain the temperature gradient distribution, and the regions in the initial temperature field whose temperature exceeds the preset temperature activation threshold are marked to obtain the flame active region.
[0048] Based on the active flame region, the preset thermal diffusivity coefficient is multiplied by the unit vector in the temperature gradient distribution to obtain the heat flux density vector, and the divergence of the heat flux density vector is calculated to obtain the heat change rate distribution.
[0049] Based on the heat change rate distribution, the initial temperature field is iteratively updated using the finite difference method to obtain the corrected temperature field.
[0050] Based on the modified temperature field, the heat source intensity is mapped using a pre-constructed heat source mapping rule to obtain the heat source intensity distribution.
[0051] Specifically, the flame base region is discretized based on a preset spatial range and a preset grid size. The preset spatial range is determined based on the actual physical dimensions of the electric fireplace product. Data on the internal width, depth, and height of the combustion chamber of mainstream electric fireplaces on the market are collected. The maximum value in each direction is taken as the upper limit of the spatial range, and the minimum value as the lower limit, thus forming a rectangular cubic region defined by six coordinate values (minimum x, maximum x, minimum y, maximum y, minimum z, maximum z). The preset grid size is determined through convergence testing. Under the same simulation conditions, different sizes (e.g., 0.005 meters, 0.01 meters, 0.02 meters) are used for trial calculations, comparing changes in the temperature field and flame morphology. The largest size with a difference of less than 1% is selected as the grid size to balance computational accuracy and resource consumption. During discretization, the number of grid nodes in each direction is calculated based on the spatial range and grid size, dividing the continuous space into a uniform three-dimensional grid. Each grid unit is identified by its center coordinates, constructing a discretized grid region.
[0052] Each grid cell is assigned an initial temperature value according to a pre-established initial temperature distribution rule, resulting in an initial temperature field. This rule is based on the actual flame temperature distribution characteristics of the electric fireplace. Multiple sets of flame temperature field data during stable combustion of the electric fireplace are collected using an infrared thermal imager. After normalizing the data, a function relationship between temperature and spatial location is fitted, for example, the temperature is highest in the central region and decreases linearly or exponentially with distance. This function is applied to each grid cell, and the initial temperature is calculated based on the distance from the cell to the center point of the flame base, thus obtaining the initial temperature field, which is stored as a three-dimensional array.
[0053] The temperature gradient distribution is calculated based on the initial temperature field and mesh size. For each internal mesh cell, the temperature difference between adjacent cells is taken along the x, y, and z directions, and divided by the mesh size to obtain the gradient component in that direction. The three components are combined into a gradient vector. Boundary cells use one-sided difference. The gradient vectors of all cells constitute the temperature gradient distribution, which is stored as a three-dimensional vector array.
[0054] Regions in the initial temperature field whose temperatures exceed a preset temperature activation threshold are designated as active flame regions. The preset temperature activation threshold is determined through statistical analysis of historical experimental data. Temperature measurements of the flame core region of the electric fireplace under different operating conditions are collected, and the 90th percentile of these values is used as the threshold to ensure that only regions with sufficiently high temperatures are considered active flame zones. For each unit in the initial temperature field, the temperature value is compared with the threshold; if it exceeds the threshold, it is marked as active, and the results are stored as a Boolean array.
[0055] Based on the active flame region, a preset thermal diffusivity is multiplied by the element vectors in the temperature gradient distribution to obtain a heat flux density vector. The divergence of this heat flux density vector is then calculated to obtain the heat change rate distribution. The preset value of the thermal diffusivity is taken from a material thermophysical property handbook, using a standard value for air (e.g., 2.2e-5 m² / s). During calculation, for each element, the thermal diffusivity is multiplied by the temperature gradient vector to obtain a heat flux density vector. The divergence of this vector is then calculated, and the differences in heat flux density components between adjacent elements in the x, y, and z directions are calculated. These differences are divided by the mesh size and summed to obtain the heat change rate for that element. Boundary elements need to consider ambient temperature; the temperature outside the boundary is treated as ambient temperature. The heat change rates of all elements constitute a heat change rate distribution, stored as a three-dimensional scalar array.
[0056] The initial temperature field is iteratively updated over time using the finite difference method based on the heat change rate distribution to obtain the corrected temperature field. The iterative update process is as follows: The time step is determined based on a stability condition, which requires the time step to be proportional to the square of the mesh size and inversely proportional to the thermal diffusivity. Specifically, the square of the mesh size is divided by twice the thermal diffusivity to obtain the critical time step. To ensure the stability of the iteration process, the actual time step is set to 80% to 90% of this critical value (for example, when the mesh size is 0.01 meters and the thermal diffusivity is 2.2e-5 square meters per second, the critical time step is approximately 2.27 seconds, but in practice it is taken as 1.8 to 2.0 seconds). After the time step is determined, for each mesh cell in the discretized mesh region, the current temperature value is multiplied by the heat change rate of that cell, then multiplied by the time step, and the product is added to the current temperature value to obtain the temperature value of that cell at the next moment. This calculation is performed synchronously for all cells in the entire mesh region, completing one time step progression. After each iteration, the absolute value of the temperature change of all elements before and after the iteration is calculated, and the maximum value is identified. This maximum value is compared with a preset convergence threshold, which is set according to the simulation accuracy requirements (e.g., 0.01 degrees Celsius). If the maximum value is less than the convergence threshold, the temperature field is considered to have reached a stable state, and the iteration stops. If the maximum value is not less than the convergence threshold, the newly calculated temperature field is used as the current temperature field, and the above iteration process is repeated. A maximum number of iterations is also set (e.g., 1000). When the number of iterations reaches this maximum, the iteration is forcibly stopped even if the convergence condition is not met, and the temperature field obtained from the last iteration is output as the corrected temperature field.
[0057] The heat source intensity distribution is obtained by mapping the heat source intensity according to a pre-constructed heat source mapping rule based on the modified temperature field. The heat source mapping rule is constructed based on experimental calibration data. The radiation intensity of the flame surface at different temperatures is measured in the laboratory to establish the correspondence between temperature and heat source intensity. A lookup table is constructed through polynomial fitting or interpolation. For each element in the modified temperature field, the corresponding heat source intensity is obtained by looking up or interpolating its temperature value in the lookup table. The heat source intensities of all elements constitute the heat source intensity distribution, which is stored as a three-dimensional scalar array. This distribution provides the physical basis for subsequent particle-driven rendering.
[0058] In step S13, based on the temperature gradient distribution and the heat source intensity distribution, the heat flux intensity is calculated to obtain the local heat flux intensity. Then, based on the local heat flux intensity, the heat flux direction vector is filtered to obtain the initial thermal driving vector, including:
[0059] Multiplying the thermal diffusivity by the magnitude of each unit vector in the temperature gradient distribution yields the basic thermal conductivity value.
[0060] The heat transfer rate is obtained by weighted summation based on the basic heat conduction values and the heat source intensity distribution.
[0061] Based on the heat transfer rate, the heat flux intensity is solved by the pre-constructed boundary heat flux rules to obtain the local heat flux intensity;
[0062] Based on the local heat flux intensity, the heat flux gradient is calculated to obtain the heat flux direction vector field;
[0063] The initial thermal drive vector is obtained by selecting the thermal flow direction vectors in the thermal flow direction vector field that are within a preset angle range and whose magnitude is greater than a preset thermal flow intensity threshold.
[0064] Specifically, the thermal diffusivity is multiplied by the magnitude of the vector of each unit in the temperature gradient distribution to obtain the basic thermal conductivity value. The temperature gradient distribution is a three-dimensional vector array calculated in step S12, with each grid cell storing a vector containing gradient components in the x, y, and z directions. The thermal diffusivity is a preset material property parameter, taken from the standard value of air in the material thermophysical handbook (e.g., 2.2e-5 square meters per second). For each grid cell, the thermal diffusivity is multiplied by the three components of the temperature gradient vector of that cell to obtain the heat flux density vector of that cell. Then, the magnitude of this vector is calculated, i.e., the square root of the sum of the squares of the three components, to obtain the basic thermal conductivity value. This value is a scalar, representing the magnitude of the heat flux intensity caused purely by the temperature gradient. The basic thermal conductivity values of all cells constitute a three-dimensional scalar array.
[0065] The heat transfer rate is obtained by weighted summation based on the basic heat conduction value and the heat source intensity distribution. The heat source intensity distribution is the three-dimensional scalar array obtained in step S12, with each cell storing a heat source intensity value. Two preset weight coefficients are used, corresponding to the basic heat conduction value and the heat source intensity, respectively, and the sum of the weight coefficients is 1. The preset values of the weight coefficients are determined through calibration using historical simulation data. Multiple sets of flame simulation results under different working conditions are collected, and the simulated flame dynamics are compared with real flame videos. The weight coefficients are adjusted so that the heat transfer rate distribution best matches the brightness changes of the real flame. The average value of multiple calibration results is taken as the final weight (e.g., basic heat conduction value weight 0.6, heat source intensity weight 0.4). For each grid cell, the basic heat conduction value is multiplied by its weight, and the heat source intensity value is multiplied by its weight. The two products are then added together to obtain the heat transfer rate of that cell. The heat transfer rates of all cells constitute a three-dimensional scalar array.
[0066] Based on the heat transfer rate, the local heat flow intensity is obtained by solving the heat flow intensity using a pre-constructed boundary heat flow rule. The boundary heat flow rule includes boundary identification logic and a heat loss calculation method. Its construction process is as follows: The boundary heat loss characteristics of the electric fireplace in a real working environment are measured experimentally. An electric fireplace test platform is built in the laboratory, and multiple temperature sensors are placed at the boundary of the flame base area. Simultaneously, ambient temperature and heat flow data at the boundary are monitored, and multiple sets of data under different operating conditions are continuously collected. Regression analysis is performed on the collected data to fit a functional relationship between ambient temperature and the boundary heat loss rate, such as a linear relationship, and the coefficients of this function are determined. The preset ambient temperature value is determined according to the standard usage scenario of the electric fireplace product, referring to the indoor comfort temperature range, and taking a typical value commonly used in the industry (e.g., 25 degrees Celsius). The boundary heat loss rate is determined statistically through the above experimental data. The ratio of boundary heat flow to internal heat flow in multiple sets of experimental data is calculated, and the average of these ratios is taken as the baseline heat loss rate. Adjustments are then made based on the deviation between the ambient temperature and the baseline value. When using this rule, all mesh elements are first traversed. The element's coordinates are used to determine if it lies on the boundary of the discretized mesh region. If any coordinate of an element reaches the minimum or maximum value of the spatial range, it is considered a boundary element. For internal elements, the heat transfer rate is directly used as the local heat flux intensity of that element. For boundary elements, the boundary heat loss rate at the current ambient temperature is calculated based on a preset ambient temperature value (e.g., 25 degrees Celsius) and a function obtained through experimental fitting. Then, the boundary attenuation coefficient is calculated, which is equal to one minus the boundary heat loss rate. Finally, the heat transfer rate is multiplied by the attenuation coefficient to obtain the local heat flux intensity of that element. The local heat flux intensities of all elements constitute a three-dimensional scalar array.
[0067] Based on the local heat flux intensity, a heat flux gradient is calculated to obtain a heat flux direction vector field. The local heat flux intensity is a three-dimensional scalar array. For each internal mesh element, the heat flux intensity values of adjacent elements are taken along the x, y, and z directions, and the difference is calculated and divided by the mesh size to obtain the heat flux gradient component in that direction. The three components are combined into a heat flux direction vector, and the direction of this vector represents the direction of the fastest increase in heat flux intensity. The gradient components of boundary elements are calculated using one-sided difference. The heat flux direction vectors of all elements constitute a heat flux direction vector field, which is stored as a three-dimensional vector array.
[0068] The initial thermal driving vector is obtained by selecting thermal flow direction vectors in the thermal flow direction vector field whose thermal flow direction vectors are within a preset angle range and whose magnitude is greater than a preset thermal flow intensity threshold. The preset angle range is determined by statistically analyzing the motion directions of real flame particles. Multiple real flame videos are collected, the motion trajectories of bright spots in the flame are tracked, and the angle distribution between their motion directions and the vertically upward direction is statistically analyzed. The 90th percentile of the angle is taken as the upper limit of the angle range (e.g., 30 degrees). Vectors with an angle less than or equal to this upper limit are considered to meet the angle requirement. The preset thermal flow intensity threshold is determined by statistically analyzing the thermal flow intensity distribution. The average and standard deviation of the magnitudes of all vectors in the thermal flow direction vector field are calculated. The average plus one standard deviation is used as the threshold to ensure that only regions with sufficiently high thermal flow intensity can drive particles. For each grid cell, the angle between its thermal flow direction vector and the vertically upward direction is first calculated. If the angle is less than or equal to the upper limit of the preset angle range and the magnitude of the vector is greater than the preset thermal flow intensity threshold, then the vector is retained as the initial thermal driving vector; otherwise, the cell is discarded. The retained vectors constitute the initial thermally driven vector field, providing a dynamic basis for subsequent particle motion that conforms to physical laws.
[0069] In step S14, based on the initial thermal driving vector, the temperature field is iteratively calculated to obtain a thermal driving vector sequence, and acceleration weighted calculation is performed based on the thermal driving vector sequence to obtain the final acceleration, including:
[0070] Based on the initial thermal driving vector, the temperature field is iteratively calculated using a pre-built temperature evolution model to obtain the current thermal driving vector;
[0071] Based on the current thermal driving vector, the acceleration is solved using Newton's second law to obtain the initial acceleration. Based on the initial acceleration, the acceleration is corrected using the boundary heat flow rule to obtain the corrected acceleration.
[0072] Based on the corrected acceleration, local heat flux is optimized using the boundary heat flux rules to obtain the optimized heat flux intensity;
[0073] Based on the optimized heat flux intensity, the temperature field is iteratively calculated using the temperature evolution model to obtain a heat-driven vector sequence;
[0074] The thermal driving vectors that exceed a preset vector intensity threshold in the thermal driving vector sequence are selected, and the accelerations are weighted and superimposed according to the selection results to obtain the final acceleration.
[0075] Specifically, based on the initial thermal driving vector, the temperature field is iteratively calculated using a pre-constructed temperature evolution model to obtain the current thermal driving vector. The temperature evolution model is a numerical model built using the finite difference method to describe the temperature field's change over time. Its construction and training process is as follows: the model adopts a three-dimensional uniform mesh structure, with the mesh size consistent with the mesh size used in the discretization process in step S12. Model parameters include the thermal diffusivity, boundary heat loss rate, and time step. The thermal diffusivity is taken from a material thermophysical property handbook, the boundary heat loss rate is determined by the boundary heat flow rule in step S13, and the time step is calculated and fixed based on the Courant condition in step S12. The model training process optimizes parameters based on a comparison between historical simulation data and real flame observation data. First, multiple sets of infrared thermal imaging sequences of real electric fireplace flames are collected, and the actual data on the temperature field's change over time are extracted as training targets. Then, for each set of actual operating conditions, simulations are performed using the model with the current parameter version to generate the corresponding simulated temperature field sequence. The absolute value of the temperature difference between each grid cell and the actual temperature field is calculated, and the average temperature difference across all cells and all time points is used as the loss function value. A grid search method is used to adjust empirical coefficients related to heat flow in the model (e.g., the fitting coefficient between boundary heat loss rate and ambient temperature). Simulations and comparisons are repeated multiple times until the loss function value no longer decreases or a preset number of iterations is reached. Finally, a set of model parameters that minimize the loss function is determined. After training, the model parameters are fixed. In subsequent use, the model input is the current temperature field and thermal driving vector, and the output is the temperature field at the next time step. During iterative calculations, starting from the initial time step, for each time step, the influence of the current thermal driving vector on the temperature field is calculated. The temperature field is updated using the heat conduction equation, and the thermal driving vector is recalculated based on the updated temperature field. This process is repeated until a preset number of iterations is reached or the convergence condition is met, ultimately obtaining the current thermal driving vector, which serves as the input for subsequent calculations.
[0076] Based on the current thermal driving vector, acceleration is calculated using Newton's second law to obtain the initial acceleration. The application of Newton's second law involves treating the current thermal driving vector as a force acting on the particle, assuming the particle mass is a unit mass (e.g., 1). The three components of the thermal driving vector are divided by the unit mass to obtain the particle's acceleration components along the three coordinate axes. The vector formed by these three components is the initial acceleration. The initial acceleration is stored as a three-dimensional vector in the grid cell corresponding to each particle.
[0077] Based on the initial acceleration, the acceleration is corrected using the boundary heat flow rule to obtain the corrected acceleration. The boundary heat flow rule, detailed in step S13, includes boundary identification logic and a correction coefficient calculation method. When using this rule, it is first determined whether the mesh cell containing the particle is located on the boundary of the flame base region. If it is an internal cell, the initial acceleration is directly used as the corrected acceleration; if it is a boundary cell, a correction coefficient is calculated based on the preset ambient temperature and boundary heat loss rate. The correction coefficient is equal to one minus the boundary heat loss rate. Then, each component of the initial acceleration is multiplied by this correction coefficient to obtain the corrected acceleration. The corrected acceleration is also stored as a three-dimensional vector.
[0078] Based on the corrected acceleration, local heat flux optimization is performed using the boundary heat flux rules to obtain the optimized heat flux intensity. This optimization process adjusts the heat flux intensity based on the corrected acceleration. For each mesh element, the modulus of the corrected acceleration is calculated. If the modulus exceeds a preset optimization trigger threshold, the heat flux intensity of that element and its neighborhood is adjusted according to the direction and magnitude of the corrected acceleration. The optimization trigger threshold is determined statistically from historical simulation data. Modulus values of the corrected acceleration are collected from multiple simulations, and the 80th percentile of these values is used as the threshold. The adjustment method involves increasing the heat flux intensity of the element by a value proportional to the modulus of the corrected acceleration. The proportionality coefficient is determined through calibration experiments. The final optimized heat flux intensity is then stored as a three-dimensional scalar array.
[0079] Based on the optimized heat flux intensity, the temperature field is iteratively calculated again using the temperature evolution model to obtain a heat driving vector sequence. This iterative calculation uses the optimized heat flux intensity as the heat source input, repeats the aforementioned temperature field update process, and generates heat driving vectors from the current time to multiple subsequent time steps. These vectors are arranged in chronological order to form a heat driving vector sequence, with each element being the heat driving vector at the corresponding time.
[0080] Thermally driven vectors exceeding a preset vector intensity threshold in the thermally driven vector sequence are selected. Based on the selection results, the accelerations are weighted and superimposed to obtain the final acceleration. The vector intensity threshold is determined by statistically analyzing the magnitudes of all vectors in the thermally driven vector sequence. The average and standard deviation of the magnitudes are calculated, and the average plus twice the standard deviation is used as the threshold to ensure that only vectors with outstanding intensity are selected. For each selected thermally driven vector, its corresponding acceleration enhancement value is calculated. The enhancement value is equal to the vector's magnitude multiplied by a preset enhancement weight. The enhancement weight is calibrated experimentally through multiple simulations under the same conditions. The weight is adjusted to match the final flame dynamics with the sudden fluctuations of a real flame, and the weight value with the best matching effect (e.g., 0.2) is selected. All enhancement values are superimposed with the initial acceleration at the corresponding moment. That is, for each selected vector, the enhancement value is added to the initial acceleration at that moment to obtain the corrected acceleration at each moment. The average of the corrected accelerations at all moments is then taken as the final acceleration. If no vector is selected, the final acceleration is the average of the initial accelerations. The final acceleration is output as a three-dimensional vector, which is used for perturbation calculations in subsequent steps.
[0081] In step S15, based on the final acceleration, the disturbance components are superimposed to obtain a hybrid thermal driving vector, and spatial displacement is calculated based on the hybrid thermal driving vector to obtain the actual trajectory sequence, including:
[0082] The thermal driving vectors whose final acceleration exceeds a preset acceleration threshold are selected from the thermal driving vector sequence to obtain the perturbation target vector;
[0083] Random sampling is performed according to a preset disturbance range to generate random disturbance components;
[0084] The random disturbance component and the disturbance target vector are superimposed to obtain a hybrid thermal drive vector;
[0085] Based on the hybrid thermal driving vector, spatial displacement is calculated using the uniformly accelerated linear motion displacement formula to obtain the actual trajectory sequence.
[0086] Specifically, the disturbance components are superimposed and spatial displacement is calculated based on the final acceleration. The thermal driving vectors corresponding to grid cells whose final acceleration exceeds a preset acceleration threshold are selected from the thermal driving vector sequence to obtain the disturbance target vector. The thermal driving vector sequence is generated in step S14, with each time step corresponding to a three-dimensional vector array stored in each grid cell. The preset acceleration threshold is determined statistically through historical simulation data. Multiple sets of final acceleration values obtained from simulations under different working conditions are collected, and the cumulative distribution function of all values is calculated. The acceleration value at the 90% point of the cumulative distribution is taken as the threshold (e.g., 0.5 m / s²). For each grid cell at the current moment, the magnitude of its final acceleration is compared with the threshold. If the magnitude is greater than the threshold, the thermal driving vector corresponding to that cell is marked as the disturbance target vector, and its three component values are extracted.
[0087] Random sampling is performed according to a preset perturbation range to generate random perturbation components. The perturbation range includes the amplitude range and the direction range. The preset values are determined by analyzing the random fluctuation characteristics of real flames. Random offsets of particle trajectories are collected from multiple real flame video clips, and the distribution of the offsets is statistically analyzed. The 90th percentile of the offsets is taken as the upper limit of the amplitude, and the lower limit of the amplitude is set to zero. The direction range takes the solid angle of the entire space, that is, all directions are equally probable. During sampling, an amplitude is first randomly generated according to a uniform distribution within the amplitude range, and then a unit direction vector is randomly generated according to a uniform distribution within the direction range. The amplitude is multiplied by the direction vector to obtain the three component values of the random perturbation component.
[0088] The random perturbation component is superimposed on the perturbation target vector. For each perturbation target vector, its three components are added to the corresponding random perturbation component to obtain three new components, which constitute the hybrid thermal driving vector. For mesh cells not marked as perturbation targets, their hybrid thermal driving vector is directly taken from the original thermal driving vector. The hybrid thermal driving vectors of all cells constitute the hybrid thermal driving vector field.
[0089] Based on the hybrid thermal driving vector, spatial displacement is calculated using the uniformly accelerated linear motion displacement formula to obtain the actual trajectory sequence. The displacement calculation is based on the kinematic equation of each particle, with the initial particle position preset as the center-bottom coordinates of the flame base region (e.g., center in the x-direction, center in the y-direction, bottom in the z-direction). For each time step, the particle's velocity is obtained by adding the acceleration to the velocity at the previous moment and multiplying by the time step. The acceleration is provided by the hybrid thermal driving vector (assuming the particle mass is unit mass, the acceleration value equals the component value of the hybrid thermal driving vector). The initial velocity is set to zero. Then, the displacement increment is calculated by multiplying the average of the velocity at the previous moment and the velocity at the current moment by the time step to obtain the displacement vector within that time step. The position at the previous moment is added to this displacement vector to obtain the current position. This process is repeated for all time steps, recording the position coordinates at each time step to form the actual trajectory sequence, which is stored as a time series of three-dimensional coordinate points. This sequence provides particle motion trajectory data for subsequent steps.
[0090] In step S16, displacement correction is performed based on the actual trajectory sequence and the temperature gradient distribution to generate a continuous path sequence. Then, based on the continuous path sequence and curvature judgment, anomaly identification is performed to obtain an abnormal path, including:
[0091] Based on the actual trajectory sequence, the displacement increment is calculated using the Euler method to obtain the displacement change.
[0092] Based on the displacement change and the temperature gradient distribution, a weighted correction is performed to obtain the corrected displacement vector;
[0093] Based on the corrected displacement vector, vector accumulation is performed to obtain a continuous path sequence;
[0094] Based on the coherent path sequence, geometric curvature calculation is performed to obtain the local curvature;
[0095] Extract the coherent paths in the coherent path sequence whose local curvature exceeds a preset local curvature threshold to obtain abnormal paths.
[0096] Specifically, based on the actual trajectory sequence, the displacement increment is calculated using the Euler method to obtain the displacement change. The actual trajectory sequence is generated in step S15, with each time step corresponding to the three-dimensional position coordinates of a particle, stored in an array in chronological order. For each time step, the position coordinates at the current moment and the position coordinates at the next moment are taken, and the coordinates at the next moment are subtracted from the coordinates at the current moment to obtain the displacement vector within that time step. The three components of this vector are the displacement change. This calculation process is performed on all adjacent time steps to obtain a series of displacement changes, each change corresponding to the displacement within a time step.
[0097] Based on the displacement change and the temperature gradient distribution, a weighted correction is performed to obtain the corrected displacement vector. The temperature gradient distribution is calculated in step S12 and stored as the temperature gradient vector for each grid cell. For each time step, the average position of the particle within that time step is first determined (e.g., the midpoint between the current and next time steps), and the corresponding temperature gradient vector is found based on this average position. Then, two weight coefficients are preset, corresponding to the influence of the original displacement change and the temperature gradient, respectively, with the sum of the weight coefficients being 1. The preset values of the weight coefficients are determined through calibration using historical simulation data. Multiple sets of flame simulation results under different working conditions are collected, and the corrected trajectory is compared with the actual flame trajectory. The weights are adjusted to maximize the trajectory matching degree, and the average of multiple calibration results is taken as the final weight (e.g., original displacement weight 0.7, temperature gradient weight 0.3). For each time step, the temperature gradient vector is multiplied by its weight to obtain the gradient correction component; the displacement change is multiplied by its weight to obtain the original displacement component; and the gradient correction component is added to the original displacement component to obtain the corrected displacement vector for that time step. The corrected displacement vectors for all time steps constitute a sequence.
[0098] Based on the corrected displacement vector, vector accumulation is performed to obtain a coherent path sequence. Starting from the initial position, the corrected displacement vector of the first time step is added to the initial position to obtain the position at the end of the first time step; then the corrected displacement vector of the second time step is added to the same position to obtain the position at the end of the second time step; and so on, repeating this accumulation process for all time steps to obtain the position coordinates at the end of each time step. These coordinates are arranged in chronological order to form a coherent path sequence.
[0099] Based on the continuous path sequence, geometric curvature calculations are performed to obtain local curvature. For each interior point on the path (i.e., points other than the beginning and end), three consecutive points are taken: the current point and its two adjacent points. The vector from the previous point to the current point, and the vector from the current point to the next point, are calculated. Then, the angle between these two vectors is calculated; the angle reflects the curvature of the path at that point. Specifically, the dot product of the two vectors is calculated first, then divided by the product of their magnitudes to obtain the cosine of the angle. The inverse cosine function is then used to obtain the angle value (in radians). This angle value is divided by the average magnitude of the two vectors to obtain the local curvature value of that point. This calculation is performed on all interior points to obtain a series of local curvature values, each corresponding to a path point.
[0100] Path segments with local curvature exceeding a preset local curvature threshold are extracted from the continuous path sequence to obtain abnormal paths. The preset local curvature threshold is determined by statistically analyzing the bending characteristics of real flame trajectories. Multiple real flame video clips are collected, particle motion trajectories are calculated, and their local curvature distribution is used as the 95th percentile (e.g., 0.8 radians per unit length). All path points are traversed. If the local curvature of a point is greater than the threshold, that point and several points before and after it (e.g., two points before and after) are marked as abnormal points. The path segment formed by these consecutively marked points is the abnormal path. Abnormal paths are stored as a sequence of coordinate points for subsequent correction processing.
[0101] In step S17, the velocity is solved according to the continuous path sequence to obtain the initial velocity sequence, and the variance of the initial velocity sequence is calculated to obtain the inter-frame continuity result.
[0102] Specifically, the velocity is calculated and the variance is determined based on the coherent path sequence to obtain the inter-frame continuity result. The coherent path sequence is generated in step S16 and stored as a series of three-dimensional coordinate points arranged in chronological order. Each point corresponds to the particle position at the end of a time step, and the time interval between two adjacent points is a preset time step (which is consistent with the time step determined in step S12). First, the velocity is calculated. For each internal point in the sequence (i.e., all points except the first and last points), the instantaneous velocity vector at that point is calculated using the central difference method. The position coordinates of the next adjacent point are subtracted from the position coordinates of the previous adjacent point to obtain the displacement vector. This displacement vector is then divided by twice the time step to obtain the velocity vector at that point. For the first point, the forward difference method is used: the position coordinates of the second point are subtracted from the position coordinates of the first point, and then divided by the time step to obtain the velocity vector of the first point. For the last point, the backward difference method is used: the position coordinates of the last point are subtracted from the position coordinates of the second-to-last point, and then divided by the time step to obtain the velocity vector of the last point. Perform the above calculations on all points to obtain a series of velocity vectors, which are arranged in chronological order to form an initial velocity sequence. Each velocity vector contains components in the x, y, and z directions.
[0103] Calculate the variance of the initial velocity sequence. First, calculate the magnitude of each velocity vector by squaring each of the three components of the vector, summing the results, and then taking the square root to obtain a series of velocity magnitude values. Then, calculate the arithmetic mean of these velocity magnitude values by summing all the magnitude values and dividing by the number of velocity vectors. For each velocity magnitude value, calculate the difference between it and the mean, and square the difference. Sum the squares of all the differences to obtain a total. Divide this total by the number of velocity vectors to obtain the variance of the initial velocity sequence. This variance value represents the inter-frame continuity result. The smaller the variance, the smaller the particle velocity change between adjacent frames, i.e., the better the inter-frame continuity; the larger the variance, the more drastic the velocity fluctuations, and the worse the inter-frame continuity. This result is used in step S18 to determine whether trajectory correction is needed.
[0104] In step S18, coordinate interpolation correction is performed based on the abnormal path and the inter-frame continuity result to obtain a corrected trajectory sequence, and trajectory smoothing is performed based on the corrected trajectory sequence to obtain an optimized trajectory sequence, including:
[0105] When the inter-frame continuity result is not lower than the preset continuity threshold, the coherent path sequence is directly used as the optimized trajectory sequence.
[0106] When the inter-frame continuity result is lower than a preset continuity threshold, the spatial coordinate points of the abnormal path are extracted to obtain an abnormal coordinate set, and the displacement vectors of adjacent coordinate points in the abnormal coordinate set are calculated to obtain a motion vector field.
[0107] The regions in the motion vector field where the magnitude of the vector exceeds a preset motion anomaly threshold are selected to obtain the regions to be corrected;
[0108] Based on the region to be corrected, coordinate interpolation is performed using a linear interpolation algorithm to obtain the corrected trajectory sequence;
[0109] Based on the corrected trajectory sequence and the abnormal path, the trajectory is smoothed using a weighted moving average method to obtain an optimized trajectory sequence.
[0110] Specifically, coordinate interpolation correction and trajectory smoothing are performed based on the abnormal path and the inter-frame continuity result. First, the inter-frame continuity result calculated in step S17 is obtained. This result is a scalar value reflecting the fluctuation of particle velocity. Simultaneously, the abnormal path extracted in step S16 is obtained. This path consists of a series of continuous three-dimensional coordinate points, corresponding to segments in the trajectory with excessive local curvature. A continuity threshold is preset. This threshold is determined through statistical analysis of historical simulation data. Multiple sets of inter-frame continuity results obtained from simulations under different working conditions are collected. Simultaneously, it is recorded whether the flame dynamics corresponding to these working conditions are evaluated as visually coherent by the observer. The maximum value of the inter-frame continuity result among the samples evaluated as coherent is taken as the threshold (e.g., 0.05). That is, below this value, visual discontinuity may occur.
[0111] When the inter-frame continuity result is not lower than the preset continuity threshold, it indicates that the current trajectory itself is already smooth enough and no correction is needed. Therefore, the coherent path sequence generated in step S16 is directly output as the optimized trajectory sequence.
[0112] When the inter-frame continuity result is lower than a preset continuity threshold, the abnormal path needs to be corrected. First, the spatial coordinates of the abnormal path are extracted to obtain an abnormal coordinate set. This set contains the three-dimensional coordinates of all points in the abnormal path, arranged in chronological order. Next, the displacement vectors of adjacent coordinate points in the abnormal coordinate set are calculated. For each pair of adjacent points, the coordinates of the previous point are subtracted from the coordinates of the next point to obtain the three components of the displacement vector. The displacement vectors of all pairs of adjacent points constitute a motion vector field, and each vector corresponds to the displacement within a time step.
[0113] Regions in the motion vector field where the magnitude of vectors exceeds a preset motion anomaly threshold are selected as the regions to be corrected. The preset value of the motion anomaly threshold is determined by statistically analyzing displacement fluctuations in normal trajectories. The magnitudes of displacement vectors in multiple visually coherent flame simulation trajectories are collected, and the average and standard deviation of these magnitudes are calculated. The average plus twice the standard deviation is used as the threshold (e.g., 0.1 unit length). Each vector in the motion vector field is traversed, and its magnitude is calculated. If the magnitude exceeds the threshold, the region between two adjacent points corresponding to that vector is marked as the region to be corrected. The regions to be corrected are represented by the indices of the start and end points.
[0114] Based on the region to be corrected, coordinate interpolation is performed using a linear interpolation algorithm to obtain a corrected trajectory sequence. For each region to be corrected, its starting and ending coordinates, as well as the number of time steps between the two points, are determined. Intermediate points are evenly inserted between the starting and ending points according to the number of time steps. The coordinates of each intermediate point are calculated using linear interpolation. The corresponding coordinate components of the starting and ending points are subtracted to obtain the total change in each direction. The total change is divided by the number of time steps to obtain the increment of change for each time step. Then, starting from the starting point, this increment is added to each step to obtain the coordinates of all intermediate points. The parts of the original abnormal path that were not marked as regions to be corrected are recombined with these newly interpolated points in chronological order to form a corrected trajectory sequence. The length of this sequence is the same as the original abnormal path, but the trajectory of the abnormal region is replaced by a smooth interpolated curve.
[0115] Based on the corrected trajectory sequence and the abnormal path, a weighted moving average method is used to smooth the trajectory, resulting in an optimized trajectory sequence. The window size for the weighted moving average method is set to an odd number (e.g., 5 points), and the weight coefficients are determined based on the distance from the current point; the closer the distance, the greater the weight, and the sum of all weights is 1. The specific values of the weight coefficients are calculated using a Gaussian function. Taking the center point of the window as the center, the spatial distance between each point within the window and the center point is calculated, and Gaussian weights are calculated based on the distance; the smaller the distance, the greater the weight. Then, all weights are normalized. For each point in the corrected trajectory sequence, two points before and after it (or usable points if on the boundary) are taken, and the coordinates of these points are multiplied by their corresponding weights and summed to obtain the smoothed new coordinates of that point. This process is performed on all points to obtain the smoothed trajectory sequence, which is the optimized trajectory sequence. This sequence serves as input for subsequent rendering, improving the visual coherence of the flame dynamics.
[0116] In step S19, based on the optimized trajectory sequence, the heat source influence area is filtered to obtain the area to be rendered, and a three-dimensional texture is generated based on the area to be rendered to obtain the flame texture output, including:
[0117] Extract the illumination intensity values from the optimized trajectory sequence to obtain the illumination intensity matrix;
[0118] Based on the light intensity matrix and the heat source intensity distribution, the Pearson correlation coefficient is calculated to obtain the heat source influence coefficient set;
[0119] The spatial regions corresponding to the heat source influence coefficients exceeding the preset heat source influence threshold are selected from the heat source influence coefficient set to obtain the region to be rendered;
[0120] Based on the area to be rendered, a three-dimensional texture is generated using a ray casting algorithm to obtain a flame texture output.
[0121] Specifically, the heat source influence area is screened and a 3D texture is generated based on the optimized trajectory sequence. First, the illumination intensity values in the optimized trajectory sequence are extracted to obtain the illumination intensity matrix. The optimized trajectory sequence is generated in step S18 and contains the 3D coordinates of particles at each time step. The heat source intensity distribution is obtained in step S12 and stored as the heat source intensity value of each grid cell in the discretized grid region. For each coordinate point in the optimized trajectory sequence, trilinear interpolation is performed on the heat source intensity distribution according to its spatial position. That is, the eight vertices of the grid cell where the point is located are found, and the distance weights between the point and each vertex in the three coordinate directions are calculated respectively. The heat source intensity values of the eight vertices are multiplied by the corresponding weights and then summed to obtain the heat source intensity value of the point. The heat source intensity is converted into light intensity using a pre-constructed illumination mapping function. The function is constructed as follows: an electric fireplace flame test platform is set up in a laboratory. A thermal imager collects heat source intensity distribution data of the flame area. An industrial camera captures flame images at corresponding times and extracts the grayscale values of each pixel as illumination intensity data. The images from the thermal imager and the camera are spatially aligned and temporally synchronized to establish a one-to-one correspondence between the heat source intensity at each spatial location and the corresponding pixel's illumination intensity. Multiple sets of corresponding point data under different operating conditions are collected to form a training dataset. The dataset is fitted with a quadratic polynomial using the least squares method. By solving for the polynomial coefficients that minimize the sum of squared errors between the fitted and actual values, the mapping function from heat source intensity to illumination intensity is obtained. After fitting, the mean absolute error is calculated using a reserved validation dataset. If the error is less than the preset accuracy requirement, the function is selected for subsequent mappings. The illumination intensities of all particles at each time step are arranged in chronological order to form an illumination intensity matrix, where rows correspond to time steps and columns correspond to particle numbers.
[0122] Pearson correlation coefficients are calculated based on the illumination intensity matrix and heat source intensity distribution to obtain a set of heat source influence coefficients. The three-dimensional space is divided into multiple equal-sized sub-regions, each containing several grid cells. For each sub-region, the illumination intensity values corresponding to all particles in the illumination intensity matrix and the heat source intensity values obtained by trilinear interpolation at the locations of these particles are extracted, resulting in two data sequences. The arithmetic mean of the two sequences is calculated, and for each data point, its deviation from the mean is calculated. The two deviations are multiplied and summed to obtain the covariance. Simultaneously, the standard deviations of the two sequences are calculated, and the covariance is divided by the product of the two standard deviations to obtain the Pearson correlation coefficient for that sub-region. The correlation coefficients of all sub-regions constitute the set of heat source influence coefficients.
[0123] The spatial regions corresponding to heat source influence coefficients exceeding a preset heat source influence threshold are selected as the rendering regions. The preset heat source influence threshold is determined through statistical analysis of historical real flame data. Regions related to heat sources and light intensity in multiple real flame scenes are collected, and the Pearson correlation coefficients for these regions are calculated. The 90th percentile of these coefficients is used as the threshold. Each coefficient in the heat source influence coefficient set is iterated over; if the coefficient is greater than the threshold, the sub-region corresponding to that coefficient is marked as the rendering region. All marked sub-regions constitute the rendering region.
[0124] Based on the area to be rendered, a 3D texture is generated using a ray casting algorithm to obtain the flame texture output. The implementation process of the ray casting algorithm is as follows: First, the viewpoint position and viewing direction of the virtual camera are defined. For each pixel on the screen, a ray is emitted from the viewpoint, passes through the pixel center, and enters the area to be rendered. Sampling is performed along the ray direction with a fixed step size, which is set to half the grid size. The heat source intensity value of each sampling point is obtained from the heat source intensity distribution through trilinear interpolation. A color transfer function and an opacity transfer function are pre-constructed. The construction process of the color transfer function is as follows: In the real flame image, the heat source intensity value is paired with the pixel RGB color value, sorted by heat source intensity value from smallest to largest, and divided into multiple intervals. The arithmetic mean of the red, green, and blue components in each interval is taken to obtain the average RGB color corresponding to that interval. Linear interpolation is used between adjacent intervals to obtain a continuous color mapping. The construction process of the opacity transfer function is as follows: A flame is captured against a solid-color background. Using a blended image of the background without flame and the image with flame, for each pixel in the flame region, the opacity value is inversely solved using the known background color and the flame color estimated by the color transfer function, based on the image blending formula. The solved opacity is paired with the corresponding heat source intensity value. Similarly, the average opacity is calculated according to the intensity interval and interpolated to obtain a continuous opacity map. At each sampling point, the corresponding RGB color and opacity value are obtained based on the heat source intensity value using the color transfer function and the opacity transfer function. Color and opacity are accumulated in order from the viewpoint to the far end. The color of the current sampling point is multiplied by its opacity, then multiplied by one and subtracted from the accumulated opacity, and added to the accumulated color. Simultaneously, the accumulated opacity is updated until the accumulated opacity approaches 1 or the ray passes through the area to be rendered. The accumulated colors of all pixels constitute a frame of flame texture image. This process is repeated for all time steps to obtain the flame texture output.
[0125] Referring to Figure 2, a second embodiment of the present invention provides a three-dimensional dynamic flame simulation generation system for electric fireplaces, comprising:
[0126] The data acquisition module is used to acquire the flame base region;
[0127] The mapping module is used to solve for the initial temperature gradient based on the flame base region to obtain the temperature gradient distribution, and to map the heat source intensity based on the temperature gradient distribution to obtain the heat source intensity distribution.
[0128] The filtering module is used to solve for the heat flux intensity based on the temperature gradient distribution and the heat source intensity distribution, to obtain the local heat flux intensity, and to filter the heat flux direction vector based on the local heat flux intensity to obtain the initial heat driving vector.
[0129] The calculation module is used to perform iterative calculation of the temperature field based on the initial thermal driving vector to obtain a thermal driving vector sequence, and to perform acceleration weighted calculation based on the thermal driving vector sequence to obtain the final acceleration;
[0130] The superposition module is used to superimpose the disturbance components according to the final acceleration to obtain a mixed thermal driving vector, and to calculate the spatial displacement according to the mixed thermal driving vector to obtain the actual trajectory sequence.
[0131] The identification module is used to perform displacement correction based on the actual trajectory sequence and the temperature gradient distribution, generate a continuous path sequence, and perform anomaly identification based on curvature judgment based on the continuous path sequence to obtain an abnormal path.
[0132] The continuity module is used to solve for the velocity based on the continuous path sequence, obtain an initial velocity sequence, calculate the variance of the initial velocity sequence, and obtain the inter-frame continuity result.
[0133] The smoothing module is used to perform coordinate interpolation correction based on the abnormal path and the inter-frame continuity result to obtain a corrected trajectory sequence, and to perform trajectory smoothing based on the corrected trajectory sequence to obtain an optimized trajectory sequence.
[0134] The output module is used to filter the heat source influence area according to the optimized trajectory sequence, obtain the area to be rendered, and generate a three-dimensional texture according to the area to be rendered to obtain the flame texture output.
[0135] It should be noted that the electric fireplace three-dimensional dynamic flame simulation generation system provided in this embodiment of the invention is used to execute all the process steps of the electric fireplace three-dimensional dynamic flame simulation generation method in the above embodiment. The working principle and beneficial effects of the two are one-to-one, so they will not be described again.
[0136] It should be noted that the system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0137] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.
Claims
1. A method for generating a three-dimensional dynamic flame simulation of an electric fireplace, characterized in that, include: Obtain the flame base region; Based on the flame base region, an initial temperature gradient is calculated to obtain a temperature gradient distribution. Then, based on the temperature gradient distribution, a heat source intensity mapping is performed to obtain a heat source intensity distribution. Based on the temperature gradient distribution and the heat source intensity distribution, a heat flux intensity is calculated to obtain a local heat flux intensity. Based on the local heat flux intensity, a heat flux direction vector is selected to obtain an initial thermal driving vector. Based on the initial thermal driving vector, an iterative temperature field calculation is performed to obtain a thermal driving vector sequence. Finally, an acceleration weighted calculation is performed based on the thermal driving vector sequence to obtain the final acceleration. Based on the final acceleration, the disturbance components are superimposed to obtain a hybrid thermal driving vector, and spatial displacement is calculated based on the hybrid thermal driving vector to obtain the actual trajectory sequence. Based on the actual trajectory sequence and the temperature gradient distribution, displacement correction is performed to generate a continuous path sequence. Based on the continuous path sequence, anomaly identification is performed based on curvature judgment to obtain the abnormal path. Based on the continuous path sequence, the velocity is solved to obtain the initial velocity sequence, and the variance of the initial velocity sequence is calculated to obtain the inter-frame continuity result. Based on the abnormal path and the inter-frame continuity result, coordinate interpolation correction is performed to obtain a corrected trajectory sequence, and trajectory smoothing is performed based on the corrected trajectory sequence to obtain an optimized trajectory sequence; based on the optimized trajectory sequence, heat source affected areas are filtered to obtain the area to be rendered, and 3D texture generation is performed based on the area to be rendered to obtain flame texture output.
2. The method for generating a three-dimensional dynamic flame simulation of an electric fireplace according to claim 1, characterized in that, The process of initializing the temperature gradient based on the flame base region to obtain a temperature gradient distribution, and mapping the heat source intensity based on the temperature gradient distribution to obtain a heat source intensity distribution, includes: discretizing the flame base region using the finite difference method according to a preset spatial range and a preset grid size to construct a discretized grid region, and assigning initial temperature values to the discretized grid region according to a pre-constructed initial temperature distribution rule to obtain an initial temperature field; calculating the temperature gradient based on the initial temperature field and the grid size to obtain a temperature gradient distribution, marking regions in the initial temperature field whose temperatures exceed a preset temperature activation threshold to obtain an active flame region; multiplying a preset thermal diffusivity coefficient by each unit vector in the temperature gradient distribution based on the active flame region to obtain a heat flux density vector, and calculating the divergence of the heat flux density vector to obtain a heat change rate distribution; iteratively updating the initial temperature field using the finite difference method based on the heat change rate distribution to obtain a corrected temperature field; and mapping the heat source intensity based on the corrected temperature field using a pre-constructed heat source mapping rule to obtain a heat source intensity distribution.
3. The method for generating a three-dimensional dynamic flame simulation of an electric fireplace according to claim 2, characterized in that, The process of calculating the heat flux intensity based on the temperature gradient distribution and the heat source intensity distribution to obtain the local heat flux intensity, and then filtering the heat flux direction vector based on the local heat flux intensity to obtain the initial heat driving vector, includes: multiplying the thermal diffusivity coefficient by the magnitude of each unit vector in the temperature gradient distribution to obtain the basic heat conduction value; performing a weighted summation based on the basic heat conduction value and the heat source intensity distribution to obtain the heat transfer rate; calculating the heat flux intensity based on the heat transfer rate using pre-constructed boundary heat flux rules to obtain the local heat flux intensity; calculating the heat flux gradient based on the local heat flux intensity to obtain the heat flux direction vector field; and filtering out the heat flux direction vectors in the heat flux direction vector field whose heat flux direction vectors are within a preset angle range and whose magnitudes are greater than a preset heat flux intensity threshold to obtain the initial heat driving vector.
4. The method for generating a three-dimensional dynamic flame simulation of an electric fireplace according to claim 3, characterized in that, The step of iteratively calculating the temperature field based on the initial thermal driving vector to obtain a thermal driving vector sequence, and then performing weighted acceleration calculation based on the thermal driving vector sequence to obtain the final acceleration, includes: iteratively calculating the temperature field based on the initial thermal driving vector using a pre-constructed temperature evolution model to obtain the current thermal driving vector; solving for acceleration using Newton's second law based on the current thermal driving vector to obtain a preliminary acceleration, and correcting the acceleration based on the preliminary acceleration using the boundary heat flow rule to obtain a corrected acceleration; optimizing the local heat flow based on the corrected acceleration using the boundary heat flow rule to obtain an optimized heat flow intensity; iteratively calculating the temperature field based on the optimized heat flow intensity using the temperature evolution model to obtain a thermal driving vector sequence; selecting thermal driving vectors in the thermal driving vector sequence that exceed a preset vector intensity threshold, and weighting and superimposing the accelerations based on the selection results to obtain the final acceleration.
5. The method for generating a three-dimensional dynamic flame simulation of an electric fireplace according to claim 1, characterized in that, The step of superimposing disturbance components based on the final acceleration to obtain a hybrid thermal driving vector, and calculating spatial displacement based on the hybrid thermal driving vector to obtain an actual trajectory sequence, includes: filtering out thermal driving vectors in the thermal driving vector sequence whose final acceleration exceeds a preset acceleration threshold to obtain a disturbance target vector; randomly sampling according to a preset disturbance range to generate random disturbance components; superimposing the random disturbance components and the disturbance target vector to obtain a hybrid thermal driving vector; and calculating spatial displacement based on the hybrid thermal driving vector using the uniformly accelerated linear motion displacement formula to obtain an actual trajectory sequence.
6. The method for generating a three-dimensional dynamic flame simulation of an electric fireplace according to claim 1, characterized in that, The process of performing displacement correction based on the actual trajectory sequence and the temperature gradient distribution to generate a continuous path sequence, and then identifying anomalies based on curvature judgment to obtain anomaly paths, includes: calculating the displacement increment using the Euler method based on the actual trajectory sequence to obtain the displacement change; performing weighted correction based on the displacement change and the temperature gradient distribution to obtain a corrected displacement vector; performing vector accumulation based on the corrected displacement vector to obtain a continuous path sequence; calculating the geometric curvature based on the continuous path sequence to obtain local curvature; and extracting continuous paths in the continuous path sequence whose local curvature exceeds a preset local curvature threshold to obtain anomaly paths.
7. The method for generating a three-dimensional dynamic flame simulation of an electric fireplace according to claim 1, characterized in that, The process of performing coordinate interpolation correction based on the abnormal path and the inter-frame continuity result to obtain a corrected trajectory sequence, and then smoothing the trajectory based on the corrected trajectory sequence to obtain an optimized trajectory sequence, includes: when the inter-frame continuity result is not lower than a preset continuity threshold, directly using the continuous path sequence as the optimized trajectory sequence; when the inter-frame continuity result is lower than the preset continuity threshold, extracting the spatial coordinate points of the abnormal path to obtain an abnormal coordinate set, and calculating the displacement vectors of adjacent coordinate points in the abnormal coordinate set to obtain a motion vector field; filtering out the regions in the motion vector field where the magnitude of the vectors exceeds a preset motion anomaly threshold to obtain the regions to be corrected; performing coordinate interpolation supplementation based on the regions to be corrected using a linear interpolation algorithm to obtain a corrected trajectory sequence; and performing trajectory smoothing based on the corrected trajectory sequence and the abnormal path using a weighted moving average method to obtain the optimized trajectory sequence.
8. The method for generating a three-dimensional dynamic flame simulation of an electric fireplace according to claim 1, characterized in that, The process of filtering heat source-affected areas based on the optimized trajectory sequence to obtain a region to be rendered, and generating a 3D texture based on the region to be rendered to obtain a flame texture output, includes: extracting the light intensity values from the optimized trajectory sequence to obtain a light intensity matrix; calculating the Pearson correlation coefficient based on the light intensity matrix and the heat source intensity distribution to obtain a heat source influence coefficient set; filtering out the spatial regions in the heat source influence coefficient set whose heat source influence coefficients exceed a preset heat source influence threshold to obtain a region to be rendered; and generating a 3D texture based on the region to be rendered using a ray casting algorithm to obtain a flame texture output.
9. A three-dimensional dynamic flame simulation generation system for an electric fireplace, characterized in that, include: The data acquisition module is used to acquire the flame base region; The mapping module is used to solve for the initial temperature gradient based on the flame base region to obtain the temperature gradient distribution, and to map the heat source intensity based on the temperature gradient distribution to obtain the heat source intensity distribution; the filtering module is used to solve for the heat flux intensity based on the temperature gradient distribution and the heat source intensity distribution to obtain the local heat flux intensity, and to filter the heat flux direction vector based on the local heat flux intensity to obtain the initial thermal driving vector; the calculation module is used to perform iterative calculation of the temperature field based on the initial thermal driving vector to obtain the thermal driving vector sequence, and to perform acceleration weighted calculation based on the thermal driving vector sequence to obtain the final acceleration; The superposition module is used to superimpose the disturbance components according to the final acceleration to obtain a mixed thermal driving vector, and to calculate the spatial displacement according to the mixed thermal driving vector to obtain the actual trajectory sequence. The identification module is used to perform displacement correction based on the actual trajectory sequence and the temperature gradient distribution, generate a continuous path sequence, and perform anomaly identification based on curvature judgment based on the continuous path sequence to obtain an abnormal path. The continuity module is used to solve for the velocity based on the continuous path sequence, obtain an initial velocity sequence, calculate the variance of the initial velocity sequence, and obtain the inter-frame continuity result. The smoothing module is used to perform coordinate interpolation correction based on the abnormal path and the inter-frame continuity result to obtain a corrected trajectory sequence, and to perform trajectory smoothing based on the corrected trajectory sequence to obtain an optimized trajectory sequence. The output module is used to filter the heat source influence area according to the optimized trajectory sequence, obtain the area to be rendered, and generate a three-dimensional texture according to the area to be rendered to obtain the flame texture output.