CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

UDF error -- too many array initializers

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 24, 2021, 15:11
Post UDF error -- too many array initializers
  #1
New Member
 
Select county
Join Date: Jul 2021
Posts: 3
Rep Power: 4
Boyan is on a distinguished road
Hi,

I was trying to interpret an UDF file for inlet velocity and outlet pressure.

When I tried to interpret it, it shows error saying "line 5: 1 too many array initializers".

How do I solve this error?

Thank you very much.

The UDF I wrote is shown below.

#include"udf.h"
DEFINE_PROFILE(normal_pre,t,i)
{
real da[300]={7642.4889,7670.7485,7738.9981,7937.4818,8345.513 1,8956.1604,9634.924,10189.3187,10528.3006,10748.9 121,10942.7303,11096.9584,11246.6543,11394.2174,11 536.8484,11715.2038,11871.8313,12025.6595,12123.36 84,12212.4128,12309.9884,12358.9095,12394.9005,124 38.4896,12442.0887,12472.3478,12492.6094,12488.610 4,12489.6768,12486.0777,12497.8081,12460.7507,1243 5.1571,12388.5021,12287.8606,12192.1512,12041.1223 ,11887.9606,11691.6097,11463.9333,11238.6563,11097 .6249,10986.7193,10882.3454,10804.8981,10716.5202, 10610.5467,10535.7654,10430.4584,10344.08,10263.70 01,10177.3217,10109.7386,10023.0936,9935.6488,9867 .5325,9779.4212,9701.7073,9630.7917,9545.3464,9462 .5671,9383.9201,9302.2072,9218.3615,9162.1089,9051 .4699,9021.744,8959.8928,8890.1769,8827.5259,8782. 2039,8732.2164,8658.6348,8619.7112,8563.7252,8509. 0722,8457.3518,8402.5655,8359.243,8309.3888,8260.7 343,8222.4772,8166.3579,8152.2281,8121.7024,8094.2 426,8067.4493,8015.9955,7960.1428,7920.4194,7864.8 333,7840.4394,7795.9172,7760.3261,7726.3346,7681.1 459,7637.2902,7608.4974,7587.3027,7542.5139,7642.4 889,7670.7485,7738.9981,7937.4818,8345.5131,8956.1 604,9634.924,10189.3187,10528.3006,10748.9121,1094 2.7303,11096.9584,11246.6543,11394.2174,11536.8484 ,11715.2038,11871.8313,12025.6595,12123.3684,12212 .4128,12309.9884,12358.9095,12394.9005,12438.4896, 12442.0887,12472.3478,12492.6094,12488.6104,12489. 6768,12486.0777,12497.8081,12460.7507,12435.1571,1 2388.5021,12287.8606,12192.1512,12041.1223,11887.9 606,11691.6097,11463.9333,11238.6563,11097.6249,10 986.7193,10882.3454,10804.8981,10716.5202,10610.54 67,10535.7654,10430.4584,10344.08,10263.7001,10177 .3217,10109.7386,10023.0936,9935.6488,9867.5325,97 79.4212,9701.7073,9630.7917,9545.3464,9462.5671,93 83.9201,9302.2072,9218.3615,9162.1089,9051.4699,90 21.744,8959.8928,8890.1769,8827.5259,8782.2039,873 2.2164,8658.6348,8619.7112,8563.7252,8509.0722,845 7.3518,8402.5655,8359.243,8309.3888,8260.7343,8222 .4772,8166.3579,8152.2281,8121.7024,8094.2426,8067 .4493,8015.9955,7960.1428,7920.4194,7864.8333,7840 .4394,7795.9172,7760.3261,7726.3346,7681.1459,7637 .2902,7608.4974,7587.3027,7542.5139,7642.4889,7670 .7485,7738.9981,7937.4818,8345.5131,8956.1604,9634 .924,10189.3187,10528.3006,10748.9121,10942.7303,1 1096.9584,11246.6543,11394.2174,11536.8484,11715.2 038,11871.8313,12025.6595,12123.3684,12212.4128,12 309.9884,12358.9095,12394.9005,12438.4896,12442.08 87,12472.3478,12492.6094,12488.6104,12489.6768,124 86.0777,12497.8081,12460.7507,12435.1571,12388.502 1,12287.8606,12192.1512,12041.1223,11887.9606,1169 1.6097,11463.9333,11238.6563,11097.6249,10986.7193 ,10882.3454,10804.8981,10716.5202,10610.5467,10535 .7654,10430.4584,10344.08,10263.7001,10177.3217,10 109.7386,10023.0936,9935.6488,9867.5325,9779.4212, 9701.7073,9630.7917,9545.3464,9462.5671,9383.9201, 9302.2072,9218.3615,9162.1089,9051.4699,9021.744,8 959.8928,8890.1769,8827.5259,8782.2039,8732.2164,8 658.6348,8619.7112,8563.7252,8509.0722,8457.3518,8 402.5655,8359.243,8309.3888,8260.7343,8222.4772,81 66.3579,8152.2281,8121.7024,8094.2426,8067.4493,80 15.9955,7960.1428,7920.4194,7864.8333,7840.4394,77 95.9172,7760.3261,7726.3346,7681.1459,7637.2902,76 08.4974,7587.3027,7542.5139,7642.4889
};

int k;

face_t f;
begin_f_loop(f,t)
{
real flow_time=RP_Get_Real("flow-time");
k=flow_time/0.008;
F_PROFILE(f,t,i) = da[k];
}
end_f_loop(f,t)

}

DEFINE_PROFILE(diseased_pre,t,i)
{
real da[300]={6842.6889,6919.3364,7159.9429,7535.7156,7712.071 5,7753.5278,7784.9866,7878.9631,8019.328,8189.5521 ,8330.7168,8476.2804,8598.1166,8720.486,8834.7241, 8917.9033,9000.5493,9069.4654,9157.4434,9223.6935, 9264.8832,9320.6026,9363.7918,9397.3834,9416.5786, 9424.9765,9454.969,9453.2361,9437.9066,9391.9181,9 350.3285,9301.2741,9244.4883,9169.1738,9129.5837,9 097.1918,9086.5278,9056.8019,9021.0775,8983.7535,8 934.2992,8905.5064,8857.3851,8826.9927,8785.1365,8 740.2144,8746.2129,8700.491,8581.5874,8595.0507,85 48.7956,8467.7492,8429.892,8363.6419,8363.1087,830 4.0568,8262.8671,8212.7463,8140.631,8094.7758,8045 .5881,8007.331,7958.8098,7926.9511,7885.6281,7832. 8413,7806.4479,7763.392,7717.9367,7680.8793,7640.0 895,7625.1599,7585.5698,7558.7765,7505.0566,7475.1 974,7434.4076,7397.2169,7367.491,7331.6333,7323.10 21,7281.9124,7260.851,7236.0572,7204.3318,7175.539 ,7135.0158,7103.2904,7065.8331,7053.8361,7021.9774 ,7003.3154,6965.5915,6939.1981,6917.2036,6872.2815 ,6854.286,6837.3569,6808.4308,6798.3,6842.6889,691 9.3364,7159.9429,7535.7156,7712.0715,7753.5278,778 4.9866,7878.9631,8019.328,8189.5521,8330.7168,8476 .2804,8598.1166,8720.486,8834.7241,8917.9033,9000. 5493,9069.4654,9157.4434,9223.6935,9264.8832,9320. 6026,9363.7918,9397.3834,9416.5786,9424.9765,9454. 969,9453.2361,9437.9066,9391.9181,9350.3285,9301.2 741,9244.4883,9169.1738,9129.5837,9097.1918,9086.5 278,9056.8019,9021.0775,8983.7535,8934.2992,8905.5 064,8857.3851,8826.9927,8785.1365,8740.2144,8746.2 129,8700.491,8581.5874,8595.0507,8548.7956,8467.74 92,8429.892,8363.6419,8363.1087,8304.0568,8262.867 1,8212.7463,8140.631,8094.7758,8045.5881,8007.331, 7958.8098,7926.9511,7885.6281,7832.8413,7806.4479, 7763.392,7717.9367,7680.8793,7640.0895,7625.1599,7 585.5698,7558.7765,7505.0566,7475.1974,7434.4076,7 397.2169,7367.491,7331.6333,7323.1021,7281.9124,72 60.851,7236.0572,7204.3318,7175.539,7135.0158,7103 .2904,7065.8331,7053.8361,7021.9774,7003.3154,6965 .5915,6939.1981,6917.2036,6872.2815,6854.286,6837. 3569,6808.4308,6798.3,6842.6889,6919.3364,7159.942 9,7535.7156,7712.0715,7753.5278,7784.9866,7878.963 1,8019.328,8189.5521,8330.7168,8476.2804,8598.1166 ,8720.486,8834.7241,8917.9033,9000.5493,9069.4654, 9157.4434,9223.6935,9264.8832,9320.6026,9363.7918, 9397.3834,9416.5786,9424.9765,9454.969,9453.2361,9 437.9066,9391.9181,9350.3285,9301.2741,9244.4883,9 169.1738,9129.5837,9097.1918,9086.5278,9056.8019,9 021.0775,8983.7535,8934.2992,8905.5064,8857.3851,8 826.9927,8785.1365,8740.2144,8746.2129,8700.491,85 81.5874,8595.0507,8548.7956,8467.7492,8429.892,836 3.6419,8363.1087,8304.0568,8262.8671,8212.7463,814 0.631,8094.7758,8045.5881,8007.331,7958.8098,7926. 9511,7885.6281,7832.8413,7806.4479,7763.392,7717.9 367,7680.8793,7640.0895,7625.1599,7585.5698,7558.7 765,7505.0566,7475.1974,7434.4076,7397.2169,7367.4 91,7331.6333,7323.1021,7281.9124,7260.851,7236.057 2,7204.3318,7175.539,7135.0158,7103.2904,7065.8331 ,7053.8361,7021.9774,7003.3154,6965.5915,6939.1981 ,6917.2036,6872.2815,6854.286,6837.3569,6808.4308, 6798.3,6842.6889
};

int k;

face_t f;
begin_f_loop(f,t)
{
real flow_time=RP_Get_Real("flow-time");
k=flow_time/0.008;
F_PROFILE(f,t,i) = da[k];
}
end_f_loop(f,t)

}

DEFINE_PROFILE(unsteady_vel,t,i)
{
real da[300]={0.11022,0.11399,0.12762,0.1551,0.1988,0.25453,0. 31645,0.37872,0.43561,0.48366,0.52168,0.54858,0.56 327,0.56537,0.55737,0.54249,0.52394,0.50485,0.4868 8,0.47016,0.45478,0.44082,0.42819,0.41622,0.40407, 0.3909,0.37593,0.35956,0.34341,0.32913,0.31837,0.3 12,0.30771,0.30239,0.29295,0.27643,0.25315,0.22674 ,0.20096,0.17959,0.16529,0.15633,0.14989,0.14315,0 .13338,0.12054,0.10719,0.096048,0.089796,0.090255, 0.095718,0.1036,0.1113,0.11631,0.11738,0.1146,0.10 808,0.097959,0.084868,0.07145,0.060856,0.056232,0. 060576,0.073401,0.090737,0.10846,0.12245,0.12961,0 .13097,0.12858,0.12449,0.12071,0.11809,0.11637,0.1 1521,0.11429,0.11338,0.11271,0.11261,0.11343,0.115 48,0.11868,0.12259,0.12672,0.13061,0.13385,0.13631 ,0.13796,0.13873,0.13859,0.13757,0.13581,0.13344,0 .13061,0.12743,0.12396,0.12024,0.11632,0.1123,0.11 022,0.11022,0.11399,0.12762,0.1551,0.1988,0.25453, 0.31645,0.37872,0.43561,0.48366,0.52168,0.54858,0. 56327,0.56537,0.55737,0.54249,0.52394,0.50485,0.48 688,0.47016,0.45478,0.44082,0.42819,0.41622,0.4040 7,0.3909,0.37593,0.35956,0.34341,0.32913,0.31837,0 .312,0.30771,0.30239,0.29295,0.27643,0.25315,0.226 74,0.20096,0.17959,0.16529,0.15633,0.14989,0.14315 ,0.13338,0.12054,0.10719,0.096048,0.089796,0.09025 5,0.095718,0.1036,0.1113,0.11631,0.11738,0.1146,0. 10808,0.097959,0.084868,0.07145,0.060856,0.056232, 0.060576,0.073401,0.090737,0.10846,0.12245,0.12961 ,0.13097,0.12858,0.12449,0.12071,0.11809,0.11637,0 .11521,0.11429,0.11338,0.11271,0.11261,0.11343,0.1 1548,0.11868,0.12259,0.12672,0.13061,0.13385,0.136 31,0.13796,0.13873,0.13859,0.13757,0.13581,0.13344 ,0.13061,0.12743,0.12396,0.12024,0.11632,0.1123,0. 11022,0.11022,0.11399,0.12762,0.1551,0.1988,0.2545 3,0.31645,0.37872,0.43561,0.48366,0.52168,0.54858, 0.56327,0.56537,0.55737,0.54249,0.52394,0.50485,0. 48688,0.47016,0.45478,0.44082,0.42819,0.41622,0.40 407,0.3909,0.37593,0.35956,0.34341,0.32913,0.31837 ,0.312,0.30771,0.30239,0.29295,0.27643,0.25315,0.2 2674,0.20096,0.17959,0.16529,0.15633,0.14989,0.143 15,0.13338,0.12054,0.10719,0.096048,0.089796,0.090 255,0.095718,0.1036,0.1113,0.11631,0.11738,0.1146, 0.10808,0.097959,0.084868,0.07145,0.060856,0.05623 2,0.060576,0.073401,0.090737,0.10846,0.12245,0.129 61,0.13097,0.12858,0.12449,0.12071,0.11809,0.11637 ,0.11521,0.11429,0.11338,0.11271,0.11261,0.11343,0 .11548,0.11868,0.12259,0.12672,0.13061,0.13385,0.1 3631,0.13796,0.13873,0.13859,0.13757,0.13581,0.133 44,0.13061,0.12743,0.12396,0.12024,0.11632,0.1123, 0.11022,0.11022
};

int k;

face_t f;
begin_f_loop(f,t)
{
real flow_time=RP_Get_Real("flow-time");
k=flow_time/0.008;
F_PROFILE(f,t,i) = da[k];
}
end_f_loop(f,t)

}
Boyan is offline   Reply With Quote

Old   August 25, 2021, 23:49
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
compile your code

btw,
this line must return integer isn't it?
Code:
k=(int)(flow_time/0.008);
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply

Tags
array initializers, fluent, udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
does Hyperthreading affect the application of UDF? SJSW Fluent UDF and Scheme Programming 11 October 10, 2018 22:28
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12
Is possible to define an array like UDM in parallel udf? supliu Fluent UDF and Scheme Programming 1 March 20, 2013 03:29
Simple UDF array question [Fluent] Patrick1 Fluent UDF and Scheme Programming 0 April 19, 2012 01:41
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


All times are GMT -4. The time now is 04:47.