Product: Abaqus/CFD
User subroutine SMACfdUserVelocityBC:
can be used to define element face velocities; and
defines the magnitude of the associated boundary condition in the global directions.
During the analysis user subroutine SMACfdUserVelocityBC is called a number of times to update the velocity and change in velocity. The returned variable should be set equal to the velocity at stepTime, where stepTime is the current step time.
void SMACfdUserVelocityBC(int nfacets, int direction, const int* labels, const int* sides, const int* instances, char** instanceNames, const double* xc, const double* yc, const double* zc, double amp, double totalIime, double stepTime, const char* surfaceName, double* bcvals);
bcvals
Values of the prescribed velocity at the element faces in the indicated direction.
nfacets
Number of element facets to be processed in this call to SMACfdUserVelocityBC.
direction
Global direction in which the velocity component is being defined.
labels
User labels for the elements attached to the facets in the boundary condition.
sides
Side numbers for the facets in the boundary condition.
instances
Instance numbers of the elements in the boundary condition.
instanceNames
Array of instance names in the model. Instance numbers provided for the elements are used to look up instance names in this array.
xc
Global X-coordinates for the centroid of the facets.
yc
Global Y-coordinates for the centroid of the facets.
zc
Global Z-coordinates for the centroid of the facets.
amp
Amplitude value corresponding to the associated amplitude function. This value is passed in for information only and will not contribute to the value of the prescribed variable automatically.
totalTime
Value of total time. The time at the beginning of the step is given by totalTime-stepTime.
stepTime
Current step time.
surfaceName
Name of the surface used to define the boundary condition.
In this example a parabolic inlet flow velocity is imposed on a channel. User subroutine SMACfdUserVelocityBC given below illustrates how the return value array is to be computed.
Input file
*HEADING Test Abaqus/CFD velocity boundary condition user subroutine *NODE 1, -10.0, 0.0, 0.0 21, 10.0, 0.0, 0.0 211, -10.0, 10.0, 0.0 231, 10.0, 10.0, 0.0 *NGEN, NSET=INLET 1, 21, 1 *NGEN, NSET=OUTLET 211, 231, 1 *NFILL, NSET=LOW INLET, OUTLET, 10, 21 *NCOPY, CHANGE NUMBER=231, OLD SET=LOW, NEW SET=HIGH, SHIFT 0.0, 0.0, -1.0 *NSET, NSET=NALL LOW, HIGH *ELEMENT, TYPE=FC3D8 1, 1, 2, 233, 232, 22, 23, 254, 253 *ELGEN, ELSET=EALL 1, 20, 1, 1, 10, 21, 20 *ELSET, GENERATE, ELSET=INLET 1, 20, 1 *ELSET, GENERATE, ELSET=OUTLET 181, 200, 1 *ELSET, GENERATE, ELSET=LEFT 1, 181, 20 *ELSET, GENERATE, ELSET=RIGHT 20, 200, 20 *SURFACE, TYPE=ELEMENT, NAME=INLET INLET, S1 *SURFACE, TYPE=ELEMENT, NAME=OUTLET OUTLET, S2 *SURFACE, TYPE=ELEMENT, NAME=TOPFACE EALL, S3 *SURFACE, TYPE=ELEMENT, NAME=BOTFACE EALL, S5 *SURFACE, TYPE=ELEMENT, NAME=LEFT LEFT, S6 *SURFACE, TYPE=ELEMENT, NAME=RIGHT RIGHT, S4 *MATERIAL, NAME=FLUID *DENSITY 1.0, *VISCOSITY 1.0E-3 *CONDUCTIVITY 1.0E-3 *SPECIFIC HEAT, TYPE=CONSTANT PRESSURE 1.0, *EXPANSION, ZERO=0.0 1.0 *FLUID SECTION, TYPE=SINGLE FLUID, ELSET=EALL FLUID *INITIAL CONDITIONS, TYPE=VELOCITY, ELEMENT AVERAGE EALL, 1, 0.0 EALL, 2, 0.0 EALL, 3, 0.0 *STEP, NAME=PARABOLIC *CFD, INCOMPRESSIBLE NAVIER STOKES, INCREMENTATION=FIXED CFL 0.01, 100.0, 0.025, 0.40, 1 1.0E-10, 1.0, 0.0, 0.0, 1.0 *FLUID BOUNDARY, TYPE=SURFACE INLET, VELY, 0.0 INLET, VELZ, 0.0 OUTLET, P, 0.0 TOPFACE, VELZ, 0.0 BOTFACE, VELZ, 0.0 LEFT, VELX, 0.0 LEFT, VELY, 0.0 LEFT, VELZ, 0.0 RIGHT, VELX, 0.0 RIGHT, VELY, 0.0 RIGHT, VELZ, 0.0 *FLUID BOUNDARY, TYPE=SURFACE INLET, VELYNU *OUTPUT, FIELD, TIME INTERVAL=0.10 *ELEMENT OUTPUT, ELSET=EALL V, PRESSURE *END STEP
User subroutine
/* User defined velocity example */ #include "SMACfdUserSubroutines.h" void SMACfdUserVelocityBC (int nfacets, int direction, const int* labels, const int* sides, const int* instances, char** instanceNames, const double* xc, const double* yc, const double* zc, double amp, double totalTime, double stepTime, const char* surfaceName, double* bcvals) { int i; if (direction == 2) { for (i = 0; i < nfacets; i++) { bcvals[i] = 1.0 - xc[i]*xc[i]/100.0; } } }