Fluid Domain
FLOWUnsteady.computefluiddomain
— Functioncomputefluiddomain( pfield::FLOWVPM.ParticleField,
grids::Array{<:GeometricTools.AbstractGrid};
optargs...
)
Evaluate the velocity and vorticity field induced by the particle field pfield
at all nodes in a set of grids grids
. The fields are added as solution fields U
and W
in each grid. The analytic Jacobian of the velocity field can also be saved using the optional argument add_J=true
.
OPTIONAL ARGUMENTS
Processing options
add_J::Bool=false
: Add the solution fieldsJ1
,J2
, andJ3
to each grid, where Ji[j]=dUi/dxj.add_Uinf::Bool=false
: It evaluates and adds the uniform freestream to theU
field.add_Wapprox::Bool=false
: It evaluates and saves the RBF-approximated vorticity field under the fieldWapprox
.zeta::Function=FLOWVPM.zeta_fmm
: Method for evaluating RBF-approximated vorticity (used only ifadd_Wapprox==true
).scale_sigma::Real=1.0
: It rescales the smoothing radius of each particle by this factor before evaluating the particle field.
Output options
save_path::String
: If used, it will save the grids as XDMF files under this path.file_pref::String
: Prefix for XDMF files.grid_names::String
: Name of each grid for XDMF files. If not given, it will generate their names automatically.num::Int
: If given, the name of the XDMF files will be"$(file_pref)$(grid_names[i]).$(num).vtk"
verbose::Bool=true
: Activate/deactivate verbose.v_lvl::Int=0
: Indentation level for printing verbose.
NOTE: The solution fields U
, W
, and Jacobian do not include the freestream field, but rather they only include the fields induced by the particles. To add the freestream to U
, use the optional argument add_Uinf=true
.
computefluiddomain(pfield::vpm.ParticleField,
nums::Vector{Int}, read_path::String, file_pref::String,
grids;
origin=nothing,
orientation=nothing,
other_read_paths=[],
other_file_prefs=[],
userfunction_pfield=(pfield, num, grids)->nothing,
optargs...
)
Evaluate the fluid domain at each time step in nums
that is induced by a particle field saved under read_path
. file_pref
indicates the prefix of the .h5 files to read.
To translate and re-orient the grids at each time step, the user can pass the new origin vector and orientation matrix through the functions origin
and orientation
, which will be called as origin(pfield, num)
and orientation(pfield, num)
at each time step.
pfield
is a place holder for loading the particles that are read, so the user must make sure that sufficient memory has been preallocated to hold the number of particles of each time step that will be read, plus the number of nodes in the grids. The fluid domain will be evaluated using the UJ and FMM configuration of the given pfield
particle field.
To read and add more than one particle field at each time step, pass a list of paths and prefixes through other_read_paths
and other_file_prefs
. This is useful for reading and incluiding a set of static particles, for example.
Give it a function userfunction_pfield
to pre-process the resulting particle field before evaluating the fluid domain (e.g., remove particles, resize core sizes, etc).
computefluiddomain(maxparticles::Int, args...;
UJ::Function=vpm.UJ_fmm,
fmm::FLOWVPM.FMM=vpm.FMM(; p=4, ncrit=50, theta=0.4, phi=0.5),
pfield_optargs=[]
optargs...)
Like the other computefluiddomain(args...; optargs...)
methods, but automatically pre-allocating and initializing the particle field with the given maximum number of particles, UJ evaluation method, and FMM configuration (if FMM is used by UJ).
Use pfield_optargs
to pass any additional optional arguments to the particle field constructor.
computefluiddomain(P_min, P_max, NDIVS, args...;
spacetransform=nothing,
O=zeros(3), Oaxis=Float64[i==j for i in 1:3, j in 1:3],
optargs...)`
Like the other computefluiddomain(args...; optargs...)
methods, but automatically generating a fluid domain grid. The grid is generated as a Cartesian box with minimum and maximum corners P_min
and P_max
and NDIVS
cells.
For instance, P_min=[-1, -1, -1]
, P_max=[-1, -1, -1]
, and NDIVS=[10, 10, 50]
will grid the volumetric space between -1 and 1 in all directions, with 10 cells in both the x and y-direction, and 50 cells in the z-direction.
Even though the grid is first generated as a Cartesian grid, this can be transformed into any other structured space through the argument spacetransform
, which is a function that takes any vector and returns another vector of the same dimensions. For instance, P_min=[0.5, 0, 0], P_max=[1, 2*pi, 5], NDIVS=[10, 20, 30], spacetransform=GeometricTools.cylindrical3D
will generate a cylindrical grid discretizing the radial annulus from 0.5 to 1 with 10 cells, the polar angle from 0 to 360deg with 20 cells, and the axial z-distance from 0 through 5 with 30 cells.
Any number of dimensions can be used, but make sure that P_min
, P_max
, and NDIVS
always have three dimensions and indicate the dimensions that are "collapsed" with a 0 in NDIVS
. Even though the grid is defined in the Cartesian axes, the origin and orientation of the grid can be specified with the O
and Oaxis
optional arguments. For instance, P_min=[0, 0, 1], P_max=[2, 3.5, 1], NDIVS=[10, 10, 0]
will generate a 2D surface laying in the xy-plane at z=1.0, spanning from (x,y)=(0,0) to (x,y)=(2,3.5). Use O=[0, 0, -1]
to move the surface back to the xy-plane at z=0. Use Oaxis=[1 0 0; 0 0 -1; 0 1 0]
to re-orient the surface to lay in the zx-plane. The same thing can be achieved with Oaxis=GeometricTools.rotation_matrix2(-90, 0, 0)
which generates the rotation matrix corresponding to a -90deg rotation about the x-axis.
NOTE: The order of operation is (1) Cartesian grid generation, (2) space transformation if any, and (3) translation and re-orientation to the given origin and orientation.
FLOWUnsteady.generate_preprocessing_fluiddomain_pfield
— Functiongenerate_preprocessing_fluiddomain_pfield(maxsigma, maxmagGamma;
verbose=true, v_lvl=1)
Generate function for pre-processing particle fields before generating fluid domain: shrink oversized particles and correct blown-up particles.
Pass the output function to FLOWUnsteady.computefluiddomain
through the keyword argument userfunction_pfield
. For example:
preprocess_pfield = generate_preprocessing_fluiddomain_pfield(maxsigma, maxmagGamma;
verbose=true, v_lvl=1)
computefluiddomain( ... ; userfunction_pfield=preprocess_pfield, ...)