How do you set up a subdomain for a source that grows in size?



Subdomains do not normally change size but it is possible to set a subdomain to be the whole domain and use a CEL expression to define the source volume. For example the following partial CEL computes a volume inside a cylinder of radius 0.3m and height 0.3m. The CEL variable insideSource will be 1 inside the source region and zero outside it. It is a simple matter to modify this expression to be a function of time.


LIBRARY:
CEL:
EXPRESSIONS:
z0 = 0.0 [m]
x0 = 0.5 [m]
y0 = 0.5 [m]
sourceRadius = 0.3 [m]
sourceHeight = 0.3 [m]
unitL = 1 [m]
rSource = sqrt((x-x0)^2 + (y-y0)^2)
hSource = z-z0
insideSource = step((sourceRadius-rSource)/unitL)*step((sourceHeight-hSource)unitL)
source = insideSource * 100 [W m^-3]
END
END
END
>update

FLOW:
DOMAIN: Domain 1
SUBDOMAIN: Subdomain 1
SOURCES:
EQUATION SOURCE: energy
Option = Source
Source = source
END
END
END
END
END
>update


It is also possible to compute the actual volume of the source region. This may be important if a total source is required and/or the source volume includes non fluid regions such as cut outsolids. Note that you cannot use the 'Total Source' option in CFX-Pre because that will divide the source value by the volume of the subdomain which is now the whole domain. Instead, a variable can be defined to be equal to the insideSource variable and a CEL expression can be used to compute the volume integral of this variable. It is a good idea to set an appropriate minimum volume to prevent a division by zero error:

LIBRARY:
ADDITIONAL VARIABLE: SourceFlag
Option = Definition
Tensor Type = SCALAR
Units = [ ]
Variable Type = Unspecified
END
CEL:
EXPRESSIONS:
volSource = volumeInt(SourceFlag)@Subdomain 1
minVolume = 0.001 [m^3]
source = insideSource * 100[W] / max(volSource, minVolume)
END
END
END
FLOW:
DOMAIN: Domain 1
FLUID MODELS:
ADDITIONAL VARIABLE: SourceFlag
Additional Variable Value = insideSource
Option = Algebraic Equation
END
END
END
END
>update





Show Form
No comments yet. Be the first to add a comment!