KR417: How can we read (interpolate) source term from point data input file not aligned with grid? (Solution ID: 625)
User has source terms (for energy eqn) that are not aligned with grid. How can this source term data be interpolated. The solution is several steps and involves a UDF (that should be compiled). -- Compile the UDF. -- Read mesh or case -- Add AT LEAST one User-Defined Scalar (UDS) and one User-Defined Memory (UDM)... -- Set up your case as much as possible and Initialize the solution. Do not iterate with the the UDS-0 yet! -- Link UDF * Define->User Defined->Functions->Compiled... Use "libudf" -- Use File->Interpolate to interpolate the SOURCE data (source_data.ip) into UDS-0 -- Use Execute on demand (copy_uds_to_udm) to copy UDS-0 into the UDM-0 -- In B.C. panel, under source term, hook source UDF with "my_source" This will then use the UDM value for the source term. -- At this point, you may remove UDS-0, since it is no longer used. The data are in UDM-0. WARNING: -- If you initizlize the solution, the UDM0 will be zeroed and thes source term will be lost. You will have to reinterpolate the UDS0 and execute the DEFINE_ON_DEMAND function (copy_uds_to_udm) again to set the source term! I would recomend saving the case/data file after you perform the DEFINE_ON_DEMAND(copy_uds_to_udm). NOTE: This function extrapolates linearly outside the defined domain of the data! /***********************/ Data file input format /**********************/ 2 (for fluent 6.0) 3 (for 3d) n (the number of points) 1 (the number of scalar functions) uds-0 (the name of the function... not arbitrary!) x1 x2 .. xn y1 y2 .. yn z1 z2 .. zn s1 s2 .. sn /************/ |
||
|