solid_cells_CGEO
Module
Description
$Id: solid_cells_stl.f90 2018-05-03 mao_chaoli@zju.edu.cn $ $Id: zjulk@zju.edu.cn, jintai@zju.edu.cn $
This module add solid (as in no-fluid) cells in the domain. This can be used e.g. in order to simulate a cylinder in a cross flow. Now, apart from the circle geometry, a 2D geometry file similar to STL can be used to represent the solid cells.Details can be found in the paper “A ghost-cell immersed boundary method for the simulations of heat transfer in compressible flows under different boundary conditions Part-II: Complex geometries”
** AUTOMATIC CPARAM.INC GENERATION ************************ Declare (for generation of cparam.inc) the number of f array variables and auxiliary variables added by this module
CPARAM logical, parameter :: lsolid_cells = .true.
Quick access
- Types:
- Variables:
adjust_inear_cart,adjust_inear_cart_glob,adjust_inear_curv,adjust_inear_curv_glob,advance_solid_cells_position,ba,ba_defined,ba_shift,bc_thermo_type,bc_vel_type,boundary_x_10th,boundary_x_6th,boundary_x_8_6th,boundary_x_8th,boundary_x_central,boundconds_x_ogrid,boundconds_y_filter,boundconds_y_ogrid,boundconds_z_ogrid,c_dragx,c_dragx_p,c_dragy,c_dragy_p,c_dragz,c_dragz_p,calc_boundary_velocity,calc_diagnostics_solid,calc_diff_ib,calc_diff_visc_coef_ib,calc_heatcond_constchi_ogrid,calc_pencils_density_ogrid,calc_pencils_energy_ogrid,calc_pencils_eos_ogrid,calc_pencils_grid_ogrid,calc_pencils_hydro_ogrid,calc_pencils_viscosity_ogrid,calc_reaction_rate,calc_solid_cells_chemistry,calculate_shift_matrix,centr_line,char_consumption,charac_len,check_cyl_pos,close_interpolation_method,coefa,coefb,communicate_filter_zones,communicate_ip_cart_to_curv,communicate_ip_curv_to_cart,construct_grid_ogrid,construct_serial_bdry_cartesian,construct_serial_bdry_curv,create_curv_cart_transform,cv,cylinder_theta,cylinder_xvel,cylinder_yvel,del2v_etc_ogrid,denergy_dt_ogrid,dfs,dim_stl,dlnrho_dt_ogrid,dot2_ogrid,drag_coeffs,drag_force_pencils,duu_dt_ogrid,find_closest_wall,find_low_gp_index_bisection,find_near_ind_global_cart,find_near_ind_global_curv,find_near_ind_local_cart,find_near_ind_local_curv,find_point,find_proc_cartesian,find_proc_curvilinear,find_solid_cell_boundaries,find_unit_vectors,fpnearestgrid,fs,gaunoise_ogrid,geometryfile,get_grid_mn_ogrid,get_mu1_full_ib,get_polar_coords,get_polar_coords_2d,get_polar_coords_3d,get_polar_coords_3d_alt,get_xx_ib,heat_cond,ib_nearest_grid,ichemsco,ichemsco2,ichemsn2,ichemso2,idiag_c_dragx,idiag_c_dragx_p,idiag_c_dragy,idiag_c_dragy_p,idiag_c_dragz,idiag_c_dragz_p,idiag_nusselt,ind_global_to_local_cart,ind_global_to_local_curv,ineargridshift,initialize_eos_ogr,initialize_grid_ogrid,initialize_interpolate_points,initialize_pade_filter,initialize_particles_ogrid,initialize_pencils_ogrid,initialize_send_ip_points_alt,input_snap_ogrid,interp_lagrange,interp_point_curv_to_cart_alt,interpolate_linear_ogrid,interpolate_ogrid_near,interpolate_ogrid_near_mom,interpolate_particles_ogrid,interpolate_point,interpolate_point_cart_to_curv,interpolate_point_curv_to_cart,interpolate_pseudocubic,interpolate_pseudoquad,interpolate_quad_ogrid,interpolate_quadratic_sp_og,inverse_grid_ogrid,irhocount,irs,isco,isco2,isn2,iso2,its,ius,ivs,iws,ixs,iys,izs,lcheck_ba,lclose_interpolation,lclose_linear,lclose_quad_rad_inter,lerror_norm,lfull_diff_ib,limit_close_linear,linear_interpolate_cartesian,linear_interpolate_curvilinear,linear_interpolate_ogrid,linear_interpolate_quadratic,lineelement,lloc_c_press_output,lloc_density_output,lloc_nusselt_output,lloc_temp_output,lnointerception,lnusselt_output,loc_coor_utvec,locchemspec_error,locdensity_error,loutput_local_reaction_rate,lpos_advance,lradius_advance,lsco,lsco2,lsecondorder_chem,lsecondorder_rho,lsimple_diff_ib,lsn2,lso2,map_nearest_grid_ogrid,max_items,maxterm,mdot_c_coeffs,mdot_c_pencils,mspecies,n_lines,new_stefan,nforcepoints,nlat,nlong,nobjects,norm_line,nrectangles,nspheres,nsvar,nusselt,nusselt_coeffs,nusselt_pencils,object_skin,objects,osci_a,osci_dir,osci_f,osci_t,output_snap_form_ogrid,output_snap_ogrid,pade_filter,pde_ogrid,poly_interp_cart,poly_interp_curv,pressure0,r_int_outer,r_theta_phi_velocity_in_point,radius_ogrid,read_snap_double_ogrid,read_snap_ogrid,read_snap_single_ogrid,read_snapshot_solid_cells,real_to_index_ogrid,reverse_normal_value,rhosum,rsnap_ogrid,run_tests_ogrid,sc_diags_reductions,sc_init_diag_accum,sc_init_reduc_pointers,scale_stl,scp,set_interpolation_limits,setup_mm_nn_ogrid,solid_ds,solid_dt,solid_flux,solid_object,solid_phi,solid_reactions_intro_time,solid_temp,solid_tempflux,solid_theta,solid_vel,solid_xpos,solid_ypos,solid_zpos,sphere_phi,sphere_temp,sphere_theta,sphere_xpos,sphere_xvel,sphere_ypos,sphere_yvel,sphere_zpos,sphere_zvel,srho,sum_line,svarname,theta_shift,time_step_ogrid,tol_stl,transform_curv_to_cart,tx_stl,ty_stl,u_dot_grad_ogrid,update_ghosts_ogrid,update_ogrid_flow_info,vertex,vs_normal,write_reactions,write_snapshot_solid_cells,wsnap_ogrid,wsnap_solid_cells,xmax_stl,xmin_stl,ymax_stl,ymin_stl- Routines:
calc_diagnostics_solid(),calc_matrix(),close_interpolation(),dsolid_dt(),dsolid_dt_integrate(),find_closest_grid_plane(),find_corner_points(),find_ib_point(),find_ib_point_mir(),find_near_indeces(),find_projection(),find_solid_cell_boundary(),fp_nearest_grid(),freeze_solid_cells(),get_stl_data(),in_solid_cell(),init_solid_cells(),initialize_solid_cells(),interpolate_idw(),interpolate_matrix(),interpolate_particles_ogrid(),is_point_on_line(),map_nearest_grid_ogrid(),output_solid_cells(),pencil_criteria_solid_cells(),read_solid_cells_init_pars(),read_solid_cells_run_pars(),register_solid_cells(),rprint_solid_cells(),sc_diags_reductions(),sc_init_reduc_pointers(),solid_cells_clean_up(),solid_cells_timestep_first(),solid_cells_timestep_second(),time_step_ogrid(),update_solid_cells(),update_solid_cells_pencil(),write_solid_cells_init_pars(),write_solid_cells_run_pars(),wsnap_ogrid()
Needed modules
cparam: $Id$cdata: $Id$general(keep_compiler_quiet()): $Id$messages: $Id$
Variables
- solid_cells/bc_thermo_type [character,optional/default='dirichlet']
- solid_cells/bc_vel_type [character,optional/default='no-slip']
- solid_cells/c_dragx (*) [real,allocatable]
- solid_cells/c_dragx_p (*) [real,allocatable]
- solid_cells/c_dragy (*) [real,allocatable]
- solid_cells/c_dragy_p (*) [real,allocatable]
- solid_cells/c_dragz (*) [real,allocatable]
- solid_cells/c_dragz_p (*) [real,allocatable]
- solid_cells/centr_line (2,10000,5) [real]
- solid_cells/charac_len (5) [real]
- solid_cells/coefa [real,optional/default=1.0]
- solid_cells/coefb [real,optional/default=1.0]
- solid_cells/dim_stl [integer,parameter=10000]
- solid_cells/flow_dir [integer]
- solid_cells/flow_dir_set [integer]
- solid_cells/fpnearestgrid (*,*,*) [integer,allocatable]
- solid_cells/geometryfile (5) [character,optional/default='1stl']
- solid_cells/idiag_c_dragx [integer,optional/default=0]
- solid_cells/idiag_c_dragx_p [integer,optional/default=0]
- solid_cells/idiag_c_dragy [integer,optional/default=0]
- solid_cells/idiag_c_dragy_p [integer,optional/default=0]
- solid_cells/idiag_c_dragz [integer,optional/default=0]
- solid_cells/idiag_c_dragz_p [integer,optional/default=0]
- solid_cells/idiag_nusselt [integer,optional/default=0]
- solid_cells/interpolation_method [character,optional/default='idw']
- solid_cells/irhocount [integer]
- solid_cells/lerror_norm [logical,optional/default=.false.]
- solid_cells/lineelement (10000,5) [real]
- solid_cells/lloc_c_press_output [logical,optional/default=.false.]
- solid_cells/lloc_density_output [logical,optional/default=.false.]
- solid_cells/lloc_nusselt_output [logical,optional/default=.false.]
- solid_cells/lloc_temp_output [logical,optional/default=.false.]
- solid_cells/loc_coor_utvec (3,10000,5) [real]
- solid_cells/lset_flow_dir [logical,optional/default=.false.]
- solid_cells/maxterm [integer,parameter=5]
- solid_cells/n_lines (5) [integer]
- solid_cells/nobjects [integer]
- solid_cells/norm_line (3,10000,5) [real]
- solid_cells/nusselt (*) [real,allocatable]
- solid_cells/reverse_normal_value [integer,optional/default=1.0]
- solid_cells/rhosum [real]
- solid_cells/scale_stl [real,optional/default=1.0]
- solid_cells/solid_flux [real,optional/default=30.0]
- solid_cells/solid_phi [real,optional/default=0.0]
- solid_cells/solid_temp [real,optional/default=330.0]
- solid_cells/solid_tempflux [real,optional/default=333.0]
- solid_cells/solid_theta [real,optional/default=0.0]
- solid_cells/solid_vel (3) [real,optional/default=(/0.0,0.0,0.0/)]
- solid_cells/solid_xpos [real,optional/default=0.0]
- solid_cells/solid_ypos [real,optional/default=0.0]
- solid_cells/solid_zpos [real,optional/default=0.0]
- solid_cells/sum_line (5) [real]
- solid_cells/t0 [real]
- solid_cells/tol_stl [real,optional/default=1e-23]
- solid_cells/tx_stl [real,optional/default=0.0]
- solid_cells/ty_stl [real,optional/default=0.0]
- solid_cells/vertex (2,2,10000,5) [real]
- solid_cells/xmax_stl (5) [real]
- solid_cells/xmin_stl (5) [real]
- solid_cells/ymax_stl (5) [real]
- solid_cells/ymin_stl (5) [real]
Subroutines and functions
- subroutine solid_cells/initialize_solid_cells(f)
Define the geometry of the solid object.
19-nov-2008/nils: coded 28-sep-2010/nils: added spheres nov-2010/kragset: updated allocations related to drag calculations 20-sep-2015/chaoli: adapted to read stl geometry file
- Parameters:
- Call to:
get_stl_data(),find_solid_cell_boundary(),fp_nearest_grid(),fatal_error()
- subroutine solid_cells/get_stl_data()
13-09-2015//: Coded by Chaoli. This subroutine is used to read line vertices and normal vectors from a STL file
- Call to:
- subroutine solid_cells/find_solid_cell_boundary(f)
Find the boundaries of the geometries such that we can set the ghost points inside the solid geometry in order to achieve the correct no-slip boundaries.
Store data in the ba array. If ba(ip,jp,kp,1)= 0 we are in a fluid cell (i.e. iline not inside a solid geometry) If ba(ip,jp,kp,1)=10 we are in a fluid cell which are so close to the
surface of the solid geometry that we must set the value of this point by some special method.(can’t.)
If ba(ip,jp,kp,1)= 9 we are inside a solid geometry, but far from the boundary If ba(ip,jp,kp,1)=-1 we are inside a solid geometry, and the point at ip+1
is outside the geometry.
- If ba(ip,jp,kp,1)=-3 we are inside a solid geometry, and the point at ip+3
is outside the geometry.
- If ba(ip,jp,kp,2)=-3 we are inside a solid geometry, and the point at jp+3
is outside the geometry.
- If ba(ip,jp,kp,2)=11 we are inside a solid geometry, either close to or far
from the boundary, but the position (ip,jp,kp) is a ghost point at the current processor. (can’t.)
The number stored in ba(ip,jp,kp,4) is the number of the object
19-nov-2008/nils: coded 14-09-2015/chaoli: adapted to include stl geometry files.
- subroutine solid_cells/init_solid_cells(f)
Initial conditions for cases where we have solid structures in the domain. Typically the flow field is set such that we have no-slip conditions at the solid structure surface.
28-nov-2008/nils: coded
- Parameters:
- Use :
initcond(gaunoise()),initialcondition(initial_condition_solid_cells())- Call to:
fatal_error(),initial_condition_solid_cells(),output_solid_cells(),find_ib_point(),find_near_indeces(),interpolate_idw(),interpolate_linear(),interpolate_matrix(),find_projection(),is_point_on_line()
- subroutine solid_cells/fp_nearest_grid()
Find coordinates for nearest grid point of all the “forcepoints” (fp) for solid object. Here, we use the centroid of the line as forceppoint.
mar-2009/kragset: coded nov-2010/kragset: updated to include spheres sep-2015/chaoli: adapted to be used for stl geometry
- subroutine solid_cells/dsolid_dt(f, df, p)
Find pressure and stress in all the forcepoints (fp) positioned on object surface, based on values in nearest grid point.
mar-2009/kragset: coded okt-2009/kragset: updated to include multiple objects nov-2010/kragset: updated to include spheres sep-2015/chaoli: adapted to include stl geometry
- subroutine solid_cells/dsolid_dt_integrate()
Calculate drag- and lift-coefficients for solid cell objects by integrating fluid force on object surface.
mar-2009/kragset: coded okt-2009/kragset: updated to include multiple objects nov-2010/kragset: updated to include spheres sep-2015/chaoli: adapted to include stl geometry
- subroutine solid_cells/rprint_solid_cells(lreset[, lwrite])
Reads and registers print parameters relevant for solid cells
mar-2009/kragset: coded nov-2010/kragset: generalized to include drag in z-direction
- Parameters:
lreset [logical]
lwrite [logical]
- Use :
- Call to:
fatal_error(),find_ib_point(),find_near_indeces(),interpolate_idw(),interpolate_linear(),interpolate_matrix(),find_projection(),is_point_on_line()
- subroutine solid_cells/update_solid_cells(f)
sep-2015/chaoli: Adapted to be used for stl geometry
- Parameters:
- Call to:
fatal_error(),find_ib_point(),find_near_indeces(),interpolate_idw(),interpolate_linear(),interpolate_matrix(),find_projection(),is_point_on_line()
- subroutine solid_cells/update_solid_cells_pencil(f)
Set the boundary values of the solid area such that we get a correct fluid-solid interface.
30-mar-15/Jorgen+nils: coded 17-jun-15/chaoli: do nothing
- Parameters:
- Call to:
- subroutine solid_cells/find_ib_point(xa, yb, zc, ib_x, ib_y, ib_z, line_index, iobj[, lfind_proj_point])
For a given ghost point, find the according IB point. IB points are defined as the normal intercepts between the normal vector starting from the given ghost point normal to solid-fluid interface and the solid boundary. Firstly, the nearest vertex to the ghost point is found. Secondly, find the normal intercept between the ghost point and the facets that share the nearest vertex.
15-09-2015/chaoli: coded
- Parameters:
xa [real,in]
yb [real,in]
zc [real,in]
ib_x [real,inout]
ib_y [real,inout]
ib_z [real,inout]
line_index [integer,out]
iobj [integer,in]
lfind_proj_point [logical]
- Called from:
- Call to:
- subroutine solid_cells/find_ib_point_mir(xa, yb, zc, ib_x, ib_y, ib_z, line_index, iobj[, lfind_proj_point])
For a given ghost point, find the according IB point. IB points are defined as the normal intercepts between the normal vector starting from the given ghost point normal to solid-fluid interface and the solid boundary. Firstly, the nearest vertex to the ghost point is found. Secondly, find the normal intercept between the ghost point and the facets that share the nearest vertex.
15-09-2015/chaoli: coded
- Parameters:
xa [real,in]
yb [real,in]
zc [real,in]
ib_x [real,inout]
ib_y [real,inout]
ib_z [real,inout]
line_index [integer,out]
iobj [integer,in]
lfind_proj_point [logical]
- Called from:
- Call to:
- subroutine solid_cells/find_projection(xa, yb, zc, iline, x_proj, y_proj, z_proj, iobj)
17-09-2015/chaoli: coded.
This subroutine is to find the projective point on the first set of triangle facets for a given ghost point.
- Parameters:
xa [real,in]
yb [real,in]
zc [real,in]
iline [integer,in]
x_proj [real,out]
y_proj [real,out]
z_proj [real,out]
iobj [integer,in]
- Called from:
- subroutine solid_cells/is_point_on_line(px, py, pz, line, lon_line, iobj)
This subroutine is to determine whether the projection is on the line.
15-09-2015/chaoli: coded.
- Parameters:
px [real,in]
py [real,in]
pz [real,in]
line [integer]
lon_line [logical,out]
iobj [integer,in]
- Called from:
- subroutine solid_cells/interpolate_idw(f, f_tmp, lower_i, lower_j, lower_k, xmirror, ymirror, zmirror, line_index, dist_mir_gp, iobj)
Interpolate value in a mirror point from the four or eight corner values the inverse distance weighting interpolation(IDW) is implemented. Chaudhuri et al. 2011
14-apr-2015/Yujuan: coded 21-sep-2015/Chaoli: adapted for the use of stl geometry
- Parameters:
- Use :
- Called from:
- Call to:
find_corner_points(),fatal_error(),find_closest_grid_plane(),find_near_indeces(),find_ib_point_mir(),calc_matrix()
- subroutine solid_cells/interpolate_linear(f, f_tmp, lower_i, lower_j, lower_k, xmirror, ymirror, zmirror, xib, yib, zib, line_index, iobj, dist_mir_gp)
Interpolate value in a mirror point from the four or eight corner values linear interpolation method is implemented.
- Parameters:
- Use :
- Call to:
fatal_error(),find_closest_grid_plane(),find_near_indeces(),find_corner_points(),find_ib_point_mir(),calc_matrix()
- subroutine solid_cells/interpolate_matrix(f, f_tmp, lower_i, lower_j, lower_k, xmirror, ymirror, zmirror, xghost, yghost, zghost, line_index, dist_mir_gp, iobj)
If interpolate point is inside the geometry, then it will be substituted by the corresponding boundary intercept point Bilinear interpolation is used for 2D case Trilinear interpolation is used for 3D case Only non-slip boundary condion for velocity can be implemented. Cindy Merlin et al.(2013)
Oct-20-2015//: Coded by Yujuan Oct-20-2015//: Adapted by chaoli for the use of stl geometry.
- Parameters:
- Use :
- Called from:
- Call to:
find_near_indeces(),find_corner_points(),find_ib_point_mir(),fatal_error(),calc_matrix()
- subroutine solid_cells/calc_matrix(xyz_matrix, var_matrix, coe_matrix)
20-Oct-2015//: Yujuan coded
- Parameters:
xyz_matrix (,) [real,in]
var_matrix (*) [real,in]
coe_matrix (*) [real,out]
- Called from:
- Call to:
- subroutine solid_cells/find_closest_grid_plane(xxg, inearg, xxm, xxib, cornervalue, cornerindex)
Find g_global based on the gridplane which is first crossed by the normal from the surface.
- Parameters:
xxg (3) [real,out]
inearg (3) [integer,out]
xxm (3) [real,in]
xxib (3) [real,in]
cornervalue (3,2) [real]
cornerindex (3,2) [integer]
- Use :
- Called from:
- Call to:
- subroutine solid_cells/find_near_indeces(lower_i, upper_i, lower_j, upper_j, lower_k, upper_k, x, y, z, ppp)
Find i, j and k indeces for all neighbouring grid points
- Parameters:
- Called from:
fp_nearest_grid(),interpolate_idw(),interpolate_matrix(),output_solid_cells()
- subroutine solid_cells/find_corner_points(fluid_point, cornervalue, cornerindex, ix0_, iy0_, iz0_[, p_global[, o_global]])
8-dec-10: coded (nils)
Based on one of the corner points this routine find all corner points of the fluid cell inwhich we are. Furthermore; if we are at a fluid point p_global is shifted slightly inside the domain.
- Parameters:
fluid_point [logical,in]
cornervalue (3,2) [real,out]
cornerindex (3,2) [integer,out]
ix0 [integer,in]
iy0 [integer,in]
iz0 [integer,in]
p_global (3) [real]
o_global (3) [real]
- Called from:
- subroutine solid_cells/freeze_solid_cells(df)
If we are in a solid cell (or in a cell where the value of the variables are found from interpolation) set df=0 for all variables
19-nov-2008/nils: coded 23-sep-2015/chaoli: adapted to be available for stl geometry
- Parameters:
- Call to:
- subroutine solid_cells/read_solid_cells_init_pars(unit[, iostat])
- Parameters:
unit [integer]
iostat [integer]
- Call to:
- subroutine solid_cells/read_solid_cells_run_pars(unit[, iostat])
- Parameters:
unit [integer]
iostat [integer]
- Call to:
- subroutine solid_cells/write_solid_cells_init_pars(unit)
- Parameters:
unit [integer,in]
- Call to:
- subroutine solid_cells/write_solid_cells_run_pars(unit)
- Parameters:
unit [integer,in]
- Call to:
- subroutine solid_cells/pencil_criteria_solid_cells()
All pencils that the Solid_Cells module depends on are specified here.
mar-2009/kragset: coded
Request p and sij-pencils here Request rho-pencil
- Call to:
- subroutine solid_cells/solid_cells_clean_up()
Deallocate the variables allocated in solid_cells
7-oct-2010/dhruba: adeped from hydro_kinematic 21-jul-2011/bing: fixed, only deallocate variable if allocted
- Call to:
- subroutine solid_cells/output_solid_cells(f, df, p)
- Parameters:
- Use :
sub(dot()),viscosity(getnu()),general(linear_interpolate()),equationofstate(get_p0())- Called from:
- Call to: