CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Unsteady function for UDF (https://www.cfd-online.com/Forums/fluent-udf/47590-unsteady-function-udf.html)

Sandilya Garimella March 12, 2008 13:02

Unsteady function for UDF
 
Hello All I am trying to solve for time varying electric potential for the potential equation ?(i.e) poisson's equation the unsteady from is helmholtz equation

[d^2 /(dt)^2] (phi) + grad^2 (phi) = source

I discretized the unsteady term (which is double derivative in time) using backward differencing and separated the terms into two terms as given in manual

Following this I wrote a simple UDF as given below

DEFINE_UDS_UNSTEADY(unsteady_function,c,t,i,apu,su )

{

real vol;

real delt;

real time;

real phi1;

real phi2;

vol = C_VOLUME(c,t);

delt = CURRENT_TIMESTEP;

time = CURRENT_TIME;

if(i==0)

{

phi1 = C_STORAGE_R(c,t,SV_UDSI_M1(i)); /* value of phi at (n-1) time step */

if(time<5.0e-6)

{

phi2 = 0;

}

else

{

phi2 = C_STORAGE_R(c,t,SV_UDSI_M2(i)); /* value of phi at (n-2) time step */

}

/* C_UDSI_M2(c,t,i);*/

*apu = (mu * epsilon * vol) / (delt * delt);

*su = (-2 * phi1 + phi2 )*mu * epsilon * vol / (delt * delt);

}

}

But when I run after hooking the UDF, till 5.0e-6 seconds the transient solutions converges.

But when it has to access the (n-2) time step term then the there is an error "ACCESS VIOLATION"

Can anyone help me to figure out if there is an error

Error:

FLUENT received fatal signal (ACCESS_VIOLATION)

1. Note exact events leading to error.

2. Save case/data under new name.

3. Exit program and restart to continue.

4. Report error to your distributor.

Error Object: ()

Can anyone help me to figure out if there is an error

gylles August 1, 2015 09:58

resolved
 
You should go: Solve --> Solution Methods --> Transient Formulation -->Second Order Implicit (on).

Good luck!!






Quote:

Originally Posted by Sandilya Garimella
;149133
Hello All I am trying to solve for time varying electric potential for the potential equation ?(i.e) poisson's equation the unsteady from is helmholtz equation

[d^2 /(dt)^2] (phi) + grad^2 (phi) = source

I discretized the unsteady term (which is double derivative in time) using backward differencing and separated the terms into two terms as given in manual

Following this I wrote a simple UDF as given below

DEFINE_UDS_UNSTEADY(unsteady_function,c,t,i,apu,su )

{

real vol;

real delt;

real time;

real phi1;

real phi2;

vol = C_VOLUME(c,t);

delt = CURRENT_TIMESTEP;

time = CURRENT_TIME;

if(i==0)

{

phi1 = C_STORAGE_R(c,t,SV_UDSI_M1(i)); /* value of phi at (n-1) time step */

if(time<5.0e-6)

{

phi2 = 0;

}

else

{

phi2 = C_STORAGE_R(c,t,SV_UDSI_M2(i)); /* value of phi at (n-2) time step */

}

/* C_UDSI_M2(c,t,i);*/

*apu = (mu * epsilon * vol) / (delt * delt);

*su = (-2 * phi1 + phi2 )*mu * epsilon * vol / (delt * delt);

}

}

But when I run after hooking the UDF, till 5.0e-6 seconds the transient solutions converges.

But when it has to access the (n-2) time step term then the there is an error "ACCESS VIOLATION"

Can anyone help me to figure out if there is an error

Error:

FLUENT received fatal signal (ACCESS_VIOLATION)

1. Note exact events leading to error.

2. Save case/data under new name.

3. Exit program and restart to continue.

4. Report error to your distributor.

Error Object: ()

Can anyone help me to figure out if there is an error



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