CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   STAR-CCM+ (http://www.cfd-online.com/Forums/star-ccm/)
-   -   Translating a user defined code in Fluent to Star-CCM (http://www.cfd-online.com/Forums/star-ccm/104781-translating-user-defined-code-fluent-star-ccm.html)

fshak92 July 16, 2012 05:16

Translating a user defined code in Fluent to Star-CCM
 
I want To simulate the movement of a laser beam on my plate,to consider the thermal effect.
Because i could'nt find a way to simulate the radiation case,I tried to define my plate boundary condition as heat flux.Therefore i wrote a table to define the movement of the laser beam by time.simple case of my table :
x y z t(1s) t(2s) t(3s) ...
1 0 0 500 0 0
2 0 0 0 500 0
3 0 0 0 0 500
.
.
.

Writing such a table is time consuming,Fortunately a guy helped me and gave me a table which has been written in .c form for the fluent.But when i set this code to my user field function,nothing happens in my simulation.
I would appreciate if anybody tell me whether this code can be readable by star-CCM ?
Thanks in advance.

DEFINE_PROFILE(laser_beam,t,i) //Randbedingung für den Energiefluss durch den Laser
{
real x[ND_ND]; //Ortsvektor; ND liest aus ob 2D oder 3D-Fall
real X; //Ortskoordinate
real x_0=0.05; //starting point
real v=0.05; //velocity of the laser beam
real b=0.005; //width of the laser beam
real I_0=50000000; //Intensity
real time=RP_Get_Real("flow-time"); //der Variable time wird die Simulationszeit zugewiesen
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t); //liest Koordinate aus
X=x[0];
if(X>=x_0+time*v-b/2 && X<=x_0+time*v+b/2) //Laser bewegt sich entlang X
F_PROFILE(f,t,i) = I_0;
else
F_PROFILE(f,t,i) = 0;
}
end_f_loop(f,t);
}

abdul099 July 16, 2012 16:44

Not sure what Star-CCM+ can do with user coding, but at least field functions are not the right point to put the code posted here.
You can use field functions when you transform your code into the right syntax.
Or you can do it by writing a Java macro.
Or you can use any programming language to write that table.

When it would be up to me, I would try to translate the code to the field function syntax first...


All times are GMT -4. The time now is 18:51.