/	fluent_journal.jou
/
/	Gambit journal file to create the fluent journal file for geometry parameterization in APECS
/
/	JFW	2/29/2008
/
/	**************************************************************************************
/
/
/
/	Open the journal file for writing
temp open "fluent_journal_file.jou"
temp write "; \n"
temp write ";  fluent_journal_file.jou\n"
temp write "; \n"
/
/
/	Read in the mesh file
temp write "; \n"
temp write ";  reading the mesh file\n"
temp write "file read-case \n"
$mesh_file_location = $mesh_directory + "/" + $mesh_name
temp write $mesh_file_location
temp write " \n"
/
/
/	check the grid
temp write "; \n"
temp write ";  checking the mesh\n"
temp write "grid check \n"
/ 
/
/	Scale the grid 
temp write "; \n"
temp write ";  scaling the mesh\n"
temp write "grid scale \n"
$geometry_scale_factor_str = NTOS($geometry_scale_factor)
temp write $geometry_scale_factor_str
temp write "\n"
temp write $geometry_scale_factor_str
temp write "\n"
temp write $geometry_scale_factor_str
temp write "\n"
/
/
/	Reorder the domain
temp write "; \n"
temp write ";  reordering the domain\n"
temp write "grid reorder reorder-domain \n"
temp write "grid reorder reorder-domain \n"
/
/
/	Read in the boundary condition file
temp write "; \n"
temp write ";  reading in boundary condition file\n"
/
/	Check to see if the boundary condition file exists
$boundary_file_name = $model_name + ".bc"
$boundary_file_exists = FILEEXISTS($working_directory + "/" + $boundary_file_name)
$boundary_file_location = $working_directory + "/" + $boundary_file_name
IF COND ($boundary_file_exists .EQ. 1)
	/  the boundary condition file exists
	temp write "file read-bc "
	temp write $boundary_file_name
	temp write "\n"
ELSE
	/  the boundary condition file does not exist
	temp write ";  ERROR:  the boundary condition file can not be found in the current working directory."
ENDIF
/
/
/	Initialize the domain
temp write "; \n"
temp write ";  initializing the domain\n"
/
/	Check to see if the interpolation file exists
$interp_file_name = $model_name + ".ip"
$interp_file_exists = FILEEXISTS($interpolation_directory + "/" + $interp_file_name)
$interp_file_location = $interpolation_directory + "/" + $interp_file_name
IF COND ($interp_file_exists .EQ. 1)
	/	The interpolation file exists - read it in
	temp write ";  interpolation file exists\n"
	temp write "file interpolate read-data \n"
	temp write $interp_file_location
	temp write " \n"
ELSE
	/	The interpolation file does not exists - initialize the domain as usual
	temp write ";  interpolation file does not exist\n"
	temp write "solve initialize initialize-flow \n"
ENDIF
/
/
/
/	Write the case file
/	temp write "; \n"
/	temp write "/  saving the case and data files\n"
/	temp write "file write-case-data \n"
/	$output_file = $working_directory + "/" + $geometry + ".cas.gz"
/	temp write $output_file
/	temp write " \n"
/
/


