|
[Sponsors] |
How to add a source term for parallel computing? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 13, 2014, 23:06 |
How to add a source term for parallel computing?
|
#1 |
New Member
Zhao An
Join Date: Jul 2014
Posts: 5
Rep Power: 12 |
My aim is to modify the epsilon equation in the realizable k-epsilon turbulence model.
This is my UDF code: Code:
#include "udf.h" #include<math.h> #define C2 1.9 /* The original value of coefficient */ DEFINE_SOURCE(source_realizable_e, c, t, dS, eqn) { #if !RP_NODE real fk = 0.5; /* The fraction of unresolved kenetic energy to the total */ real fe = 1.0; /* The fraction of unresolved rate of dissiptation to the total */ real source; real k_temp = C_K(c,t); real e_temp = C_D(c,t); source = -(fk/fe-1)*C2*e_temp*e_temp/(k_temp+sqrt(0.001003/998.2*e_temp)); dS[eqn] = 0.0; return source; #endif #if RP_NODE dS[eqn] = 0.0; return 0.0; #endif } DEFINE_PRANDTL_D(Prandtl_realizable_e, c, t) { #if !RP_NODE real fk = 0.5; /* The fraction of unresolved kenetic energy to the total */ real fe = 1.0; /* The fraction of unresolved rate of dissiptation to the total */ return 1.2*fk*fk/fe; #endif #if RP_NODE return 1.2; #endif } Thank you in advance! |
|
November 14, 2014, 09:54 |
|
#2 |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
I don't really know what do you want to do, but try something like this
#include "udf.h" #include<math.h> #define C2 1.9 /* The original value of coefficient */ DEFINE_SOURCE(source_realizable_e, c, t, dS, eqn) { #if !RP_HOST real fk = 0.5; /* The fraction of unresolved kenetic energy to the total */ real fe = 1.0; /* The fraction of unresolved rate of dissiptation to the total */ real source; real k_temp = C_K(c,t); real e_temp = C_D(c,t); source = -(fk/fe-1)*C2*e_temp*e_temp/(k_temp+sqrt(0.001003/998.2*e_temp)); dS[eqn] = 0.0; return source; #endif } DEFINE_PRANDTL_D(Prandtl_realizable_e, c, t) { #if !RP_HOST real fk = 0.5; /* The fraction of unresolved kenetic energy to the total */ real fe = 1.0; /* The fraction of unresolved rate of dissiptation to the total */ return 1.2*fk*fk/fe; #endif } I think that the host process has nothing to do with your code. Cheers |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swak4Foam-groovyBC build problem | zxj160 | OpenFOAM Community Contributions | 18 | July 30, 2013 14:14 |
add source term in energy equation | chaolian | OpenFOAM Programming & Development | 4 | November 8, 2012 23:22 |
"parabolicVelocity" in OpenFoam 2.1.0 ? | sawyer86 | OpenFOAM Running, Solving & CFD | 21 | February 7, 2012 12:44 |
pisoFoam compiling error with OF 1.7.1 on MAC OSX | Greg Givogue | OpenFOAM Programming & Development | 3 | March 4, 2011 18:18 |
Add time dependent Source term | libe | OpenFOAM Running, Solving & CFD | 13 | September 23, 2010 10:12 |