Presentation is loading. Please wait.

Presentation is loading. Please wait.

ACUSIM Software Inc., 2685 Marine Way, Suite 1215, Mountain View, California 94043 Tel: (650) 988-9700 Fax: (650) 988-9770

Similar presentations


Presentation on theme: "ACUSIM Software Inc., 2685 Marine Way, Suite 1215, Mountain View, California 94043 Tel: (650) 988-9700 Fax: (650) 988-9770"— Presentation transcript:

1 ACUSIM Software Inc., 2685 Marine Way, Suite 1215, Mountain View, California Tel: (650) Fax: (650) Acusim Software Inc. Proprietary Information Vorticity Field from DES solution AcuSolve ™ Training Course - December 2004

2 Page 2 What is AcuSolve? A powerful general-purpose finite element incompressible flow solver AcuSolve’s differentiation Robustness Most problems solved on the first attempt with little or no user intervention Speed Coupled solver on distributed parallel machines scales almost linearly Accuracy Highly accurate in space and time while globally and locally conservative on all meshes FunctionalityRich set of functionality; continuously growing An ideal enabling technology for integrated engineering and scientific tools

3 Page 3 AcuSolve Markets Markets currently using AcuSolve: Automotive Electronic cooling Chemical mixing Medical and medical equipments Oil and offshore platform Boat design Train aerodynamics Universities National labs General consulting Etc...

4 Page 4 AcuSolve Working Models Stand-alone solver Interfaced to a number of third party pre- and post-processors Embedded in an integrated system Knowledge of Application & Users Customized GUI Geometric Modeler Automatic Mesh Generator Auxiliary Pre-processor(s) Solver: AcuSolve Auxiliary Post-processor(s) Visualizer Adaptivity Design Optimizer

5 Page 5 Functionality Conservation equation systems in 3D Incompressible Stokes and Navier-Stokes equations Thermal analysis and conjugate heat transfer Multi-layered thermal shell Multi-species transport equations Radiation Gray body enclosure radiation View factor computation Solar radiation Computational Aero- Acoustic (CAA) Support Pseudo-compressibility CAA output/interface support

6 Page 6 Functionality (cont) Turbulence Models One-equation Spalart-Allmaras RANS model Smagorinsky and dynamic subgrid LES models Hybrid RANS/LES model Arbitrary Eulerian Lagrangian (ALE) Technology Flexible mesh movement Free surface modeling Sliding mesh Rigid body interaction Fluid/Structure interaction (FSI)

7 Page 7 Functionality (cont) Rotating Flows Multiple frames of reference Component Technology Fan component Heat exchanger component Rich Set of Material Options Newtonian and non-Newtonian fluids Porous media Melting and heat of formation User-defined function

8 Page 8 Functionality (cont) Full Set of Boundary Conditions Dirichlet and Neumann boundary conditions Periodic and axisymmetric conditions Thermal periodic condition Integrated surface boundary condition General two-point constraint Experimental data imposition Dynamic BC activation Non-reflecting BC User-defined function

9 Page 9 Functionality (cont) Highly Effective Solver Technology Fast and robust iterative linear solvers A novel and highly efficient iterative solver for the fully coupled pressure/velocity equation system A companion fully coupled temperature/flow iterative equation solver Fully parallel on shared/distributed memory machines, transparent to user Solution Strategy Fast steady state solver Second-order time-accurate transient analysis Automatic time-stepping algorithms

10 Page 10 Functionality (cont) Advanced finite element technology Galerkin/Least-Squares finite element method Equal-order (nodal) interpolation for all solution fields, including pressure Unstructured mesh:  4-node tetrahedron  5-node pyramid  6-node wedge  8-node brick  10-node tetrahedron Particle Tracer Laminar Turbulent diffusion Parallel computation

11 Page 11 Third Party Interface Direct interfaces by third party: ICEM-CFD MeshSim GridPro Harpoon Import formats: ANSYS cdb Exodus Fluent case file SDRC I-Deas

12 Page 12 Third Party Interface (cont) Interface to visualizers: Amira(file) CGNS(file) Ensight(direct/file) Exodus(file) FieldView (file) ICEM CFD Visual3(direct) OpenDX(direct/file) ParaView(direct) SDRC I-Deas(file) Spectrum (file) Tecplot(CGNS) Raw Table(file) Output data access: C/Perl/Python callable API

13 Page 13 Programs AcuSolve is a collection of programs Solver Programs: Used for solving a CFD problem given a valid input file. acuRunRun acuPrep, acuView and acuSolve in scalar/parallel acuPrepPrepare the user data to be run by acuSolve acuViewCompute viewfactor to be used by acuSolve acuSolveSolve a problem, prepared by acuPrep acuSigSignal acuSolve to perform certain actions while it is executing

14 Page 14 Programs (cont) Pre-processing Programs: Used for creating an input file and associated data file for running the solver. acuImportImport a mesh or problem from an external format acuSurfExtract external surfaces of a mesh acuSifSplit internal surfaces acuProjProject solution fields to another mesh

15 Page 15 Programs (cont) Post-processing Programs: Used for post processing or extracting data for post processing solver results. acuTransTranslate acuSolve solution output to other formats acuTraceGenerate particle traces from a solver solution Post Processing with Third Party Software: Direct AcuSolve readers into third party software  EnSight  ICEM CFD Visual3  ParaView  OPENDX

16 Page 16 Programs (cont) User-Defined Function Programs: Used compiling user-defined functions. acuMakeLibMake a dynamic shared library from user codes for UNIX/LINUX platforms acuMakeDllMake a Windows dll file from user codes

17 Page 17 Programs (cont) License Manager Programs: Used for license management. acuLmiExtract host information for issuing a license acuLmgNetwork license manager start, stop, query acuLmdNetwork license manager daemon acuLmg and acuLmd are UNIX/LINUX specific

18 Page 18 Programs (cont) There are many more utility programs See MANIFEST.txt in the distribution for a complete list bin (supported programs): =========================================================================== | File | Type | Description | =========================================================================== |+acuDmg | Python | Directory management tool | | acuDplace | Perl | Determine optimum dplace value for Altix | | acuEnSight6To5 | Script | Convert an EnSight6 file to EnSight5 | | acuFmt | Exec | ASCII/binary conversion of AcuSolve files | | acuGetData | Exec | Get AcuSolve results data | | acuImport | Exec | Import CFD files to AcuSolve |... bin (unsupported programs): =========================================================================== | File | Type | Description | =========================================================================== | acuCheckBadTets | Script | Check for tets with internal no-slip BC | | acuCheckTets | Script | Check/correct node ordering of tet mesh | | acuCp | Perl | Copy an input file(s) in a new directory | | acuCpi | Exec | Standard MPI PI (3.1415) test |

19 Page 19 Software Distribution You can download the software distribution from Follow the directions to download and install the distribution CDROM available upon request Obtain a valid license from your distributor Send the host and hostid obtained by running acuLmi Obtain a set of examples from

20 Page 20 Supported Platforms PlatformOS ALPHAOSF1 V4.0f HPHP-UX 11.0 HPIPFHP-UX 11.0 (Itanium II) LINUXRedhat 7.1 (Intel IA32) LINUX64 (new) SuSE SLES-8 (AMD64) LINUXIPFRedhat 2.1AW (Itanium II) NTWindows NT/2000/XP (IA32) SGI64IRIX 6.5 SUNSolaris 2.7

21 Page 21 Parallel Models PlatformParallel OptionacuRun -mp ALPHA OpenMP (shared memory) MPICH (TCP/IP) Digital-MPI PMPI (Elans) openmp mpi dmpi pmpi HP OpenMP (shared memory) HP-MPI (all networks) openmp mpi HPIPFOpenMP (shared memory) HP-MPI (all networks) openmp mpi

22 Page 22 Parallel Models PlatformParallel OptionacuRun -mp LINUX OpenMP (shared memory) MPICH (TCP/IP) HP-MPI (many networks) MPICH-GM (Myrinet) Scali-MPI openmp mpi hpmpi gmpi scampi LINUX64 MPICH (TCP/IP) HP-MPI (many networks) XD1 (Cray-Octigabay) Scali-MPI mpi hpmpi octmpi scampi LINUXIPFOpenMP (shared memory) MPICH (TCP/IP) HP-MPI (many networks) MPICH-GM (Myrinet) MPT (Altix) openmp mpi hpmpi gmpi mpt

23 Page 23 Parallel Models PlatformParallel OptionacuRun -mp NT OpenMP (shared memory) MPICH-NT (shared memory) openmp mpi SGI64 SGI Shared Memory Parallel MPICH (TCP/IP) sgi mpi SUNMPICH (TCP/IP)mpi

24 Page 24 Documentation This Tutorial Guide Three Manuals Commands Reference Manual  Online html Programs Reference Manual User Defined Function Manual Download at (the bottom of) Simple notes in the distribution directory: $ACUSIM_HOME/$ACUSIM_MACHINE/$ACUSIM_VERSION/doc AcuSolve Quick Command Reference Online html with SI units Pointers to unit conversion tools

25 Page 25 Support Clifton Park, NY office (primary) Mountain View, CA office

26 Page 26 Setup Environment UNIX/LINUX Find and source the file.acusim (.acusim-sh on bash): source $ACUSIM_HOME/$ACUSIM_MACHINE/latest/script/.acusim Windows Double-click on “acusim” shortcut on Desktop, or open Start->Programs->ACUSIM Software->AcuSolve V1.6 - Command Prompt This opens a Windows command prompt (DOS window) They set environment variables ACUSIM_HOME main distribution directory ACUSIM_MACHINE platform (eg., LINUX) ACUSIM_VERSION AcuSolve version (eg., V1.6) ACUSIM_CNF_FILES List of configuration files They set execution path $ACUSIM_HOME/$ACUSIM_MACHINE/$ACUSIM_VERSION/bin

27 Page 27 Channel Flow Solve a laminar flow in a channel Copy following directory to temporary location & cd to it: UNIX: $ACUSIM_HOME/$ACUSIM_MACHINE/$ACUSIM_VERSION/ examples/channel NT: C:\Acusim\NT\%ACUSIM_VERSION%\examples\channel Run the problem by issuing the command: acuRun Creates a log file channel.1.Log Creates an input echo file channel.1.echo Creates a directory ACUSIM.DIR containing solution data base

28 Page 28 Channel Flow (cont) Exact solution Parabolic velocity with maximum x-velocity of 1 Pressure drop of 0.2 Get solution statistics: acuTrans -out -to stats The output of this command will be similar to: acuTrans: Variable Min Max Ave acuTrans: x_velocity e e e-01 acuTrans: y_velocity e e e-09 acuTrans: z_velocity e e e+00 acuTrans: pressure e e e-01

29 Page 29 Channel Flow (cont) Visualize using FieldView: acuTrans -out -to fieldview This creates the FieldView file channel_step fv Visualize using EnSight: Open “File->Data (Reader)” and select “AcuSolve” in “Format” Set the Geometry to channel.1.Log and click OK See file doc/ensight.txt for directions on EnSight reader setup Visualize using ICEM-CFD Visual3: Select AcuSolve file from inside of Visual3 and import file And more options...

30 Page 30 Program Options Each program requires zero or more options Options may be given on the command line: acuRun -pb channel -np 2 Options may be placed in the configuration file, Acusim.cnf: problem= channel num_processors= 2 and the program invoked as: acuRun Command line options take precedence over configuration files and defaults.

31 Page 31 Program Options (cont) Each option has a (long) descriptive and a (short) abbreviated name: Following are equivalent: acuRun -pb channel acuRun -problem channel Following configuration options are equivalent: pb= channel problem= channel Short names are typically used for command line option and long names for the configuration file. Most options also have default values

32 Page 32 Program Options (cont) Environment variable ACUSIM_CNF_FILES is used to specify multiple configuration files. By default, it is set to four files: ./Acusim.cnf Typically contains current problem configuration  ~/Acusim.cnf Typically contains user’s most used configurations  $ACUSIM_HOME/$ACUSIM_MACHINE/$ACUSIM_VERSI ON /script/Acusim.cnf Typically contains system and installation configurations, such as license manager information  $ACUSIM_HOME/Acusim.cnf Typically contains site specific configurations These configuration files are searched in sequence

33 Page 33 Program Options (cont) To get a list of options and values, issue the command with “-h”: acuRun -h This produces results such as: acuRun: Usage: acuRun: acuRun [options] acuRun: Options: acuRun: -h print usage and exit acuRun: help= TRUE [command-line] acuRun: -pb problem name acuRun: problem= channel [./Acusim.cnf] acuRun: -v verbose level acuRun: verbose= 1 [default] acuRun: Configuration Files: acuRun: /Acusim.cnf:~/Acusim.cnf:/acusim/SGI64/V1.6/script/Acusim.cnf acuRun: Release: 1.6

34 Page 34 Program Options (cont) Options may be: String acuRun -pb channel problem= channel Enumerated (from a list of available options) acuTrans -to ideas translate_to= ideas Boolean acuRun -echo acuRun -no_echo echo_input=TRUE echo_input=FALSE

35 Page 35 Program Options (cont) Integer acuRun -np 2 num_processors= 2 Real acuSurf -angle 89.9 max_angle= 89.9 To specialize an option for a program and/or a machine prepend them to the option: SGI64.host_lists= eagle,hawk,falcon acuSurf.verbose= 2 SGI64.acuSurf.verbose= 3

36 Page 36 AcuSolve Input File AcuSolve input file is an ASCII file consisting of one or more commands, each having zero or more parameters. Commands define problem parameters such as nodes, elements, boundary conditions, output, material models, solution strategy, etc. Input file is built from an unstructured mesh obtained from any third party mesh generator. The mesh must contain all geometric entities: nodal coordinates, element connectivity, nodal, periodic and element boundary conditions, etc. If nodal, periodic and element boundary conditions are not available, acuSurf may be used to extract them.

37 Page 37 Channel Problem Statement

38 Page 38 Channel Input File ##************************************************************* ## Copyright (c) ACUSIM Software, Inc. ## All rights reserved. ## This source code is confidential and may not be disclosed. ##************************************************************* #============================================================== # # "channel.inp": channel input file # #============================================================== # Global data #============================================================== ANALYSIS { title = "Laminar channel flow" sub_title = "Reynolds number = 200" mode = static } EQUATION { flow = navier_stokes }

39 Page 39 Channel Input File (cont) #============================================================== # Solution Strategy #============================================================== AUTO_SOLUTION_STRATEGY { max_time_steps = 100 convergence_tolerance = 1.e-4 } #============================================================== # Material model #============================================================== DENSITY_MODEL( "simple fluid" ) { density = 1 } VISCOSITY_MODEL( "simple fluid" ) { viscosity = } MATERIAL_MODEL( "simple fluid" ) { density_model = "simple fluid" viscosity_model = "simple fluid" }

40 Page 40 Channel Input File (cont) #============================================================== # Coordinates #============================================================== COORDINATE { coordinates = Read( "channel.crd" ) } #============================================================== # Elements #============================================================== ELEMENT_SET( "interior" ) { elements = Read( "channel.cnn" ) shape = eight_node_brick material_model = "simple fluid" }

41 Page 41 Channel Input File (cont) #============================================================== # Inflow boundary conditions #============================================================== SIMPLE_BOUNDARY_CONDITION( "inflow" ) { surfaces = Read( "channel.inflow.srf" ) shape = four_node_quad element_set = "interior" type = inflow inflow_type = mass_flux mass_flux = 0.66 } #============================================================== # Wall boundary conditions #============================================================== SIMPLE_BOUNDARY_CONDITION( "wall" ) { surfaces = Read( "channel.wall.srf" ) shape = four_node_quad element_set = "interior" type = wall }

42 Page 42 Channel Input File (cont) #============================================================== # Outflow boundary conditions #============================================================== SIMPLE_BOUNDARY_CONDITION( "outflow" ) { surfaces = Read( "channel.outflow.srf" ) shape = four_node_quad element_set = "interior" type = outflow pressure = 0 } #============================================================== # No-cross flow nodal boundary conditions #============================================================== NODAL_BOUNDARY_CONDITION( "no-cross flow z-velocity" ) { variable = z_velocity nodes = Read( "channel.all.nbc" ) }

43 Page 43 Channel Input File (cont) #============================================================== # Initial conditions #============================================================== NODAL_INITIAL_CONDITION( velocity ) { default_values = { 1, 0, 0 } } NODAL_INITIAL_CONDITION( pressure ) { default_value = 0 } #============================================================== # Nodal output #============================================================== NODAL_OUTPUT { output_frequency = 10 } #============================================================== # Restart option #============================================================== RESTART_OUTPUT { output_frequency = 10 }

44 Page 44 Channel Input File (cont) #============================================================== # Surface outputs #============================================================== SURFACE_OUTPUT( "inflow" ) { surfaces = Read( "channel.inflow.srf" ) shape = four_node_quad element_set = "interior" integrated_output_frequency = 1 } SURFACE_OUTPUT( "outflow" ) { surfaces = Read( "channel.outflow.srf" ) shape = four_node_quad element_set = "interior" integrated_output_frequency = 1 } SURFACE_OUTPUT( "wall" ) { surfaces = Read( "channel.wall.srf" ) shape = four_node_quad element_set = "interior" integrated_output_frequency = 1 } #============================================================== # Run the problem #============================================================== RUN

45 Page 45 Command Format Commands have the following general syntax: COMMAND ( qualifier ) { parameter1= value1... parameterN= valueN } COMMAND is the name of the command, such as ANALYSIS qualifier (including the parentheses) is a mandatory qualifier parameter1 to parameterN are optional parameters. Commands are format free and case insensitive, except in double quoted strings. All text after a hash mark, “#”, is a comment; except in double- quoted strings. ANALYSIS { mode = static # Run as static for now }

46 Page 46 Command Format (cont) There are two types of commands: Functional & Declarative Functional commands perform operations at the time they are read: AUTO_SOLUTION_STRATEGY RESTART RUN INCLUDE ASSIGN QUIT Declarative commands define the problem parameters. They are order-independent.  NODAL_BOUNDARY_CONDITION commands may be specified before or after the COORDINATE command; even though the former depend on the latter. Placement of functional commands is important.

47 Page 47 Command Qualifier Some commands require a qualifier Qualifiers distinguish one use of the command from another: MATERIAL_MODEL( "air" ) { density_model= "air at std. atm." viscosity_model= "air" } MATERIAL_MODEL( "aluminum" ) { density_model= "aluminum" conductivity_model= "aluminum" } If a command accepts a qualifier, one must be given. If a command does not require a qualifier, there must be none.

48 Page 48 Command Qualifier (cont) There are two types of qualifiers: User-given name:  Any double-quoted string: “air”, “my #1 BC”.  Used to reference a command by another command DENSITY_MODEL( "air at std. atm." ) { density= } MATERIAL_MODEL( "air" ) { density_model= "air at std. atm." viscosity_model= "air" } Enumerated:  Select from a specific list of values: NODAL_INITIAL_CONDITION( velocity ) { default_values= { 1, 0, 0 } }

49 Page 49 Parameter Format Commands have zero or more parameters Most parameters have default values Parameters are persistent; they change only if the command is reissued with that parameter: DENSITY_MODEL( "air with bouyancy" ) { density= } DENSITY_MODEL( "air with bouyancy" ) { expansivity= } Seven types of parameters: String, Enumerated, Boolean, Integer, Real, List and Array

50 Page 50 Parameter Format (cont) String is any user-given value enclosed in a pair of double-quotes. Typically used to refer to a particular issuance of another command May contain up to 1023 characters SIMPLE_BOUNDARY_CONDITION( "inflow" ){ element_set= "channel" } Enumerated is a set of options available for a given parameter. Parameter shape of ELEMENT_SET command accepts: four_node_tet, five_node_pyramid, six_node_wedge, eight_node_brick and ten_node_tet ELEMENT_SET( "channel" ) { shape= eight_node_brick }

51 Page 51 Parameter Format (cont) Boolean turns an option on or off. Values on, yes and true are equivalent; so are off, no and false. TIME_INCREMENT { auto_time_increment= on } Integer is an integer value. An integer parameter may have a valid range. Some integer values may have special meaning. NODAL_OUTPUT { output_frequency= 10 } Real is a floating point value. A real parameter may have a valid range. NODAL_OUTPUT { output_time_interval= 0.3 }

52 Page 52 Parameter Format (cont) List is a set of strings providing a list of user-specified commands: Order of strings in the list is important TIME_SEQUENCE { Staggers= { "flow stagger", "turb stagger" } } Array is a set of integers, floating point numbers, or both: The array may be specified directly in the input file: PERIODIC_BOUNDARY_CONDITION( "axisymmetric PBC" ) { rotation_axis= { 0, 0, 0 ; 0, 0, 1 } } The array may be read from an external file: COORDINATE { coordinates= Read( "channel.crd" ) }

53 Page 53 Parameter Format (cont) Arithmetic expressions may be used in integer, real and array parameters: ASSIGN { variable= SHIFT value= Sin( PI/8 + Asin(.3) ) } MULTIPLIER_FUNCITON( "shifted half sin" ) { type= cubic_spline curve_fit_variable= time curve_fit_values= { 0.0, SHIFT + Sin(0.0*PI) ; 0.1, SHIFT + Sin(0.1*PI) ; , SHIFT + Sin(1.0*PI) ; } } Operations +, -, *, /, ^ (for power) and parentheses are available. Standard C math functions, Abs(x), Acos(x),..., Tanh(x), plus Max(x,y) and Min(x,y) are available. Variables E, PI and EPS (machine precision) are predefined.

54 Page 54 Parameter Format (cont) Values may be read from an environment variable: SIMPLE_BOUNDARY_CONDITION( "inflow" ) { x_velocity= Env( "INLET_VELOCITY" ) } On UNIX cshell the variable is set as cshell-prompt> setenv INLET_VELOCITY 20 This is particularly useful for parametric studies foreach vel ( ) echo "Processing velocity " $vel " … " setenv INLET_VELOCITY $vel acuRun acuTrans – out – to stats > STATS.$vel end Strings may also be imported COORDINATES { coordinates= Read(Env("PROBLEM"). ".crd") }

55 Page 55 Solver Commands Problem Description Commands: ANALYSIS global analysis data EQUATION equations present in the problem Radiation Control Commands: RADIATION global enclosure radiation param’s SOLAR_RADIATION global solar radiation parameters

56 Page 56 Solver Commands (cont) User Control Data Command: USER_GLOBAL_DATA define and initialize globally- accessible data Multiplier Function Command: MULTIPLIER_FUNCTION scale values of other commands at run time Reference Frame Command: REFERENCE_FRAME reference frame of elements and BCs Mesh Motion and Control Commands: MESH_MOTION mesh motion of nodes (rigid body) FLEXIBLE_BODY global FSI control parameters

57 Page 57 Solver Commands (cont) Solution Strategy Commands: AUTO_SOLUTION_STRATEGY automatically create a solution strategy by issuing the commands below TIME_SEQUENCE time stepping and staggering strategy STAGGER linear and nonlinear solution parameters of an equation TIME_INCREMENT time increment and control param’s CONVERGENCE_CHECK_PARAMETERS parameters for fine tuning convergence checking TIME_INTEGRATION predictor multi-corrector integration LINEAR_SOLVER_PARAMETERS parameters for fine tuning linear equation solvers

58 Page 58 Solver Commands (cont) Body Force Commands: GRAVITY gravitational body force ROTATION_FORCE force due to rotating frame of reference (obsolete) HEAT_SOURCE volumetric heat source (Watts/kg) SPECIES_SOURCE volumetric species source BODY_FORCE collection of volumetric body forces

59 Page 59 Solver Commands (cont) Material Model Commands: DENSITY_MODEL density model SPECIFY_HEAT_MODEL specific heat at constant pressure VISCOSITY_MODEL viscosity model CONDUCTIVITY_MODEL thermal conductivity model DIFFUSIVITY_MODEL species diffusivity model POROSITY_MODEL porosity model for the flow equations MATERIAL_MODEL collection of material models SURFACE_TENSION_MODEL surface tension for free surf. CONTACT_ANGLE_MODEL contact angle for free surface EMISSIVITY_MODEL emissivity for a radiation surface SOLAR_RADIATION_MODEL solar radiation model

60 Page 60 Solver Commands (cont) Nodal Data Commands: COORDINATE nodal coordinates NODAL_INITIAL_CONDITION nodal initial conditions NODAL_BOUNDARY_CONDITION nodal BCs PERIODIC_BOUNDARY_CONDITION periodic BCs on pairs of nodes NODAL_OUTPUT nodal output parameters DERIVED_QUANTITY_OUTPUT output derived-quantities RUNNING_AVERAGE_OUTPUT output running-averaged fields TIME_AVERAGE_OUTPUT output time-averaged fields TIME_HISTORY_OUTPUT nodal output for a set of prescribed points NODAL_RESIDUAL_OUTPUT output nodal residuals

61 Page 61 Solver Commands (cont) Element Data Commands: ELEMENT_SET set of elements FAN_COMPONENT fan component HEAT_EXCHANGER_COMPONENT heat exchanger component LINE_SOURCE source on an arbitrary line ELEMENT_OUTPUT output element-integrated data CAA_OUTPUT output CAA sample data

62 Page 62 Solver Commands (cont) Surface Data Commands: SIMPLE_BOUNDARY_CONDITION common BC ELEMENT_BOUNDARY_CONDITION element BC SURFACE_INTEGRATED_CONDITION integrated BC on a surface FREE_SURFACE free surface TURBULENCE_WALL turbulent boundary layer wall RADIATION_SURFACE radiation heat flux on a surface SOLAR_RADIATION_SURFACE solar radiation heat flux on a surface PARTICLE_SURFACE surface type for particle tracing INTERFACE_SURFACE sliding mesh & tied interface GUIDE_SURFACE guide moving mesh on a surface SURFACE_OUTPUT output fluxes on surface

63 Page 63 Solver Commands (cont) Restart Commands: RESTART_OUTPUT output restart files RESTART restart from a previously solved problem Run Command: RUN process the input data for the solver Auxiliary Commands: INCLUDE include the content of an external file ASSIGN assign a value to a variable QUIT terminate parsing the input file

64 Page 64 AcuSolve Quick Reference Manual Parameter Name (Abbr.) TypeDefaultUnit in SILimits Enum Values (Abbr.) DENSITY_MODEL( user_name ) type enumconstant constant (const) boussinesq piecewise_linear (linear) cubic_spline (spline) user_function (user) density (dens)real1kg/m3>0 expansivity (expans)real11/K>=0 curve_fit_values (curve_values)array{0,1}kg/m3 curve_fit_variable (curve_var) enumtemperature pressure (pres) temperature (temp) species_1 (spec1) species_2 (spec2) species_3 (spec3) species_4 (spec4) species_5 (spec5) species_6 (spec6) species_7 (spec7) species_8 (spec8) species_9 (spec9) user_function (user)strundefined

65 Page 65 Geometry Format Coordinates file is used in the COORDINATE command Four columns: nodeId, x, y, z: e e e e e e e e e-01 Nodal BC file is used in the NODAL_BOUNDARY_CONDITION command Single column: nodeId

66 Page 66 Geometry Format (cont) Nodal Initial Condition file is used in the NODAL_INITIAL_CONDITION command Multi-columns: nodeId, field values (e.g., velocity): Periodic BC file is used in the PERIODIC_BOUNDARY_CONDITION command Three columns: pairId, node1, node2:

67 Page 67 Geometry Format (cont) Element Connectivity file is used in the ELEMENT_SET command Multi-columns: elementId, node1,..., nodeN (e.g., 4-node tet):

68 Page 68 Geometry Format (cont) Surface Connectivity file is used in commands: ELEMENT_BOUNDARY_CONDITION FAN_COMPONENT FREE_SURFACE GUIDE_SURFACE HEAT_EXCHANGER_COMPONENT INTERFACE_SURFACE PARTICLE_SURFACE RADIATION_SURFACE SIMPLE_BOUNDARY_CONDITION SOLAR_RADIATION_SURFACE SURFACE_INTEGRATED_CONDITION SURFACE_OUTPUT TURBULENCE_WALL

69 Page 69 Geometry Format (cont) Surface Connectivity (cont): Multi-columns: elementId, surfaceId, node1,..., nodeN (e.g., 3- node triangle): Program acuSurf may be used to extract and/or convert into this format

70 Page 70 Output AcuSolve generates four types of output data Nodal, such as nodal output at a certain time step Time Series, such as integrated mass flux at inlet as a function of time/time step Surface Nodes, such as heat flux at each node of a wall surface at a certain time step CAA sample data, such as divergence of Lighthill stress acuTrans may be used to translate from internal format Get statistics on nodal velocity at steps 5 through 15 acuTrans –out –outv velocity –to stats –ts 5:15 Translate mass flux at inflow to a raw table acuTrans –osi –osiv mass –osis " inflow " –to table Translate heat flux at nodes of the wall to a raw table acuTrans –osf –osfv heat –osfs " wall surface " –to table

71 Page 71 Output (cont) Surface Nodes output fields may be collected for all nodes for ease of viewing Translate heat fluxes of all surface output nodes to a raw table acuTrans –out –extout -outv surface_heat_flux –to table  Nodes not in any available surface output will have zero values Visualize all available Nodal and Surface Nodes data with FieldView do acuTrans –out –extout –to fieldview Visualize all available Nodal and Surface Nodes data with EnSight or Visual3, put the following in Acusim.cnf Extended_nodal_output= TRUE

72 Page 72 Output Fields Solver CommandacuTrans OptionData Type NODAL_OUTPUTnodal_outputNodal RUNNING_AVERAGE_OUTPUTrunning_average_outputNodal TIME_AVERAGE_OUTPUTtime_average_outputNodal DERIVED_QUANTITY_OUTPUTderived_quantity_outputNodal SURFACE_OUTPUTsurface_outputSurface Nodes SURFACE_OUTPUTsurface_integral_outputTime Series RADIATION_SURACEoutput_radiation_surfaceSurface Nodes RADIATION_SURACEoutput_radiation_integralTime Series SOLAR_RADIATION_SURFACEoutput_solar_radiation_surfaceSurface Nodes SOLAR_RADIATION_SURFACEoutput_solar_radiation_integralTime Series ELEMENT_OUTPUTelement_integral_outputTime Series TIME_HISTORY_OUTPUTtime_history_outputTime Series FAN_COMPONENTfan_component_outputTime Series HEAT_EXCHANGER_COMPONENTheat_exchanger_component_outputTime Series NODAL_RESIDUAL_OUTPUToutput_nodal_residualNodal CAA_OUTPUTaero_acoustic_outputSample

73 Page 73 Cross Platform Compatibilities All internal files are stored in ACUSIM.DIR directory They are accesses through ADB (libadb.a) C-callable API &  Python through “import acudb”  Perl through “use Acudb ;”  Shell through acuGetData program All programs (eg., acuTrans) are written on top of ADB Vast majority of the files are in binary  ADB handles all cross platform binary compatibilities Files written on one platform may be read on any platform All supported programs can read ASCII files generated on Windows The Windows end-of-line carriage return (Cntl-M) character is properly handled on all platforms

74 Page 74 Boundary Conditions There are two boundary condition basic types: Dirichlettypically a condition on the field variables Neumanntypically a flux condition Boundary condition equivalence: This classification is not entirely one-to-one. Pressure may be either a Dirichlet or Neumann condition We prefer Nodal and Element BC It reflects implementation and usage DirichletNeumann NodalElement StrongWeak EssentialNatural

75 Page 75 Boundary Conditions (cont) Nodal and Element BCs are conjugates For flow equations: Nodal boundary conditionElement boundary condition x-velocity,x-traction, y-velocity,y-traction, z-velocity,z-traction, normal-velocity,pressure, tangential-velocity,tangential-traction, pressure,mass flux,

76 Page 76 Boundary Conditions (cont) Boundary condition precedence: Element boundary condition of type “free” means that boundary condition value is taken from the current solution By default, mass flux is of type free Precedence may be used to favor one boundary condition over another imposed on the same node Nodal BCElement BCConsequence Specified Nodal BC is satisfied; Element BC is ignored SpecifiedNot specifiedNodal BC is satisfied Not specifiedSpecifiedElement BC is satisfied Not specified Element BC with zero/free value is assumed and satisfied

77 Page 77 Boundary Conditions (cont) Inflow condition: All three velocity components are specified Mass flux is set to “inflow” (which is a special case of “free”) All scalar fields (temperature, turbulence eddy viscosity, species) are specified For example: SIMPLE_BOUNDARY_CONDITION( "inlet" ) { surfaces= Read( "channel.inlet.ebc" ) shape= four_node_quad element_set= "flow" type= inflow x_velocity= 5 y_velocity= 0 z_velocity= 0 temperature= 20 species_1= 1 eddy_viscosity= }

78 Page 78 Boundary Conditions (cont) Inflow condition (cont) SIMPLE_BOUNDARY_CONDITION supports the following inflow types: velocity impose three components of velocity pressure impose pressure at inlet stagnation_pressure impose stagnation pressure at inlet mass_flux impose mass flux flow_rate impose flow rate In mass_flux and flow_rate types, velocity and eddy-viscosity profiles are internally computed

79 Page 79 Boundary Conditions (cont) Outflow condition: Pressure is specified as an element boundary condition Mass flux is set to “outflow” (which is a special case of “free”) Tangential traction, heat flux, species flux, and turbulence flux are set to free For example: SIMPLE_BOUNDARY_CONDITION( "outlet" ) { surfaces= Read( "channel.outlet.ebc" ) shape= four_node_quad element_set= "flow" type= outflow pressure= 0 }

80 Page 80 Boundary Conditions (cont) No-slip wall: All three velocity components are set to zero (in the wall reference frame) Either heat flux or temperature is specified; similarly for species Turbulence eddy viscosity is zero; turbulence wall is defined For example: SIMPLE_BOUNDARY_CONDITION( "wall surface" ) { surfaces= Read( "channel.wall.ebc" ) shape= four_node_quad element_set= "flow" type= wall reference_frame= "rotating disc" temperature_type= flux heat_flux= 250 convective_heat_coefficient= 35 convective_heat_reference_temperature= 20 species_1_type= value species_1= 5 }

81 Page 81 Boundary Conditions (cont) Slip wall and symmetric condition: Normal component of velocity is zero All fluxes are zero For example: SIMPLE_BOUNDARY_CONDITION( "symmetry" ) { surfaces= Read( "channel.sym.ebc" ) shape= four_node_quad element_set= "flow" type= slip }

82 Page 82 Boundary Conditions (cont) Axisymmetric condition: All nodal variables No flux specification is needed For example: PERIODIC_BOUNDARY_CONDITION( "axisym. planes" ){ nodal_pairs= Read( "pipe.axi.pbc" ) variable= all type= axisymmetric rotation_axis= { 0, 0, 0; 0, 0, 1 } } Other periodic conditions: Depends on the condition

83 Page 83 Boundary Conditions (cont) All velocity boundary condition: When velocity is imposed on all boundaries of the domain, a pressure nodal BC must be imposed on one and only one node (per enclosure) AcuSolve has a rich set of boundary conditions; see commands: ELEMENT_BOUNDARY_CONDITION FREE_SURFACE NODAL_BOUNDARY_CONDITION PERIODIC_BOUNDARY_CONDITION RADIATION_SURFACE SIMPLE_BOUNDARY_CONDITION SOLAR_RADIATION_SURFACE SURFACE_INTEGRATED_CONDITION TURBULENCE_WALL

84 Page 84 Solution Strategy Simplest way to set up a strategy is via AUTO_SOLUTION_STRATEGY ANALYSIS { type= transient } EQUATION { flow= navier_stokes temperature= advective_diffusive radiation= enclosure turbulence= spalart_allmaras } AUTO_SOLUTION_STRATEGY { max_time_steps= 100 initial_time_increment= 1 } AUTO_SOLUTION_STRATEGY is a functional command Its position in the file is important Reads parameters of ANALYSIS and EQUATION commands Devises a solution strategy, writes it in file.ss.inc It includes the file in its place

85 Page 85 Example.ss.inc TIME_SEQUENCE { min_time_steps = 1 max_time_steps = 100 final_time = 0 convergence_tolerance = 0 termination_delay = 0 lhs_update_initial_times = 1 lhs_update_frequency = 1 min_stagger_iterations = 2 max_stagger_iterations = 2 stagger_convergence_tolerance = stagger_lhs_update_frequency = 1 staggers = { "flow", "turbulence", "temperature", "radiation" } }

86 Page 86 Example.ss.inc (cont) STAGGER( "flow" ) { equation = flow min_stagger_iterations = 1 max_stagger_iterations = 1 convergence_tolerance = 0.1 lhs_update_frequency = 1 linear_solver = gmres min_linear_solver_iterations = 10 max_linear_solver_iterations = 1000 num_krylov_vectors = 10 linear_solver_tolerance = 0.1 projection = off pressure_projection = on pressure_projection_tolerance = 0.01 velocity_projection = off velocity_projection_tolerance = 0.1 } STAGGER( "turbulence" ) {... }...

87 Page 87 Example.ss.inc (cont) TIME_INCREMENT { initial_time_increment = 1 auto_time_increment = off local_time_increment = off min_time_increment = 0 max_time_increment = 0 cfl_control = off cfl_number = 1000 initial_cfl_number = 1 min_cfl_number = 0 time_increment_decrease_factor = 0.25 time_increment_increase_factor = 1.25 time_increment_increase_delay = 4 min_time_increment_ratio = 0.1 multiplier_function = "none" }

88 Page 88 Example.ss.inc (cont) TIME_INTEGRATION { predictor = same_v initialize_acceleration = off lumped_mass_factor = 1 time_integration_order = second high_frequency_damping_factor = 1 }

89 Page 89 Example.ss.inc (cont) LINEAR_SOLVER_PARAMETERS { lhs_storage = reduced_memory_sparse min_num_iteration_ratio = 0.5 num_pressure_projection_vectors = } CONVERGENCE_CHECK_PARAMETERS { pressure_residual_check = standard pressure_solution_increment_check = looser_by_10... }

90 Page 90 Advance Solution Strategy AUTO_SOLUTION_STRATEGY is sufficient for most problems Its generated parameters may be overwritten like AUTO_SOLUTION_STRATEGY { max_time_steps= 100 initial_time_increment= 1 } TIME_SEQUENCE { min_stagger_iterations= 1 max_stagger_iterations= 4 } Major modifications done in.ss.inc and included like #AUTO_SOLUTION_STRATEGY { # max_time_steps= 100 # initial_time_increment= 1 #} INCLUDE { file= " example.ss.inc.mod " }

91 Page 91 Steady Solution Strategy For steady state problems AUTO_SOLUTION_STRATEGY accepts ANALYSIS { type= steady } AUTO_SOLUTION_STRATEGY { max_time_steps= 100 initial_time_increment= 1.e+10 convergence_tolerance= 1.e-3 num_krylov_vectors= 10 temperature_flow= off relaxation_factor= 0 }

92 Page 92 Transient Solution Strategy For transient problems AUTO_SOLUTION_STRATEGY accepts ANALYSIS { type= transient } AUTO_SOLUTION_STRATEGY { max_time_steps= 100 initial_time_increment= 1 final_time= 0 auto_time_increment= off min_time_increment= 0 max_time_increment= 0 convergence_tolerance= 1.e-3 num_krylov_vectors= 10 temperature_flow= off relaxation_factor= 0 }

93 Page 93 Time Stepping Pseudo Code Loop over time steps Predict all active solution fields Loop over staggers Stagger 1: Loop over nonlinear iterations Form stagger residual and if needed LHS matrix Solve linear equation system Update stagger solution field(s) Check nonlinear convergence End nonlinear loop... Stagger N: Loop over nonlinear iterations Form stagger residual and if needed LHS matrix Solve linear equation system Update stagger solution field(s) Check nonlinear convergence End nonlinear loop Check stagger convergence End stagger loop Check time step convergence Optionally compute and output results Determine time increment of the next time step End time step loop

94 Page 94 AcuSolve Log File acuRun: Tue Jun 22 17:41: acuRun: acuRun acuRun: Processing run 1... acuRun: Hostname = pelican acuRun: Release = 1.6 acuRun: Reseting num_subdomains to 2 acuRun: Run acuPrep... acuRun: /usr/acusim/SGI64/latest/bin/acuPrep -nsd 2 acuPrep: Date = Tue Jun 22 17:41: acuPrep: Problem = channel acuPrep: Run = 1 acuPrep: Hostname = pelican acuPrep: Platform = IRIX IP30 acuPrep: Release = 1.6 acuPrep: Release date = May acuPrep: Number of subdomains = 2 acuPrep: Working directory = ACUSIM.DIR acuPrep: acuPrep: Reading ANALYSIS acuPrep: Reading EQUATION acuPrep: Reading AUTO_SOLUTION_STRATEGY acuPrep: Processing AUTO_SOLUTION_STRATEGY acuPrep: AUTO_SOLUTION_STRATEGY: creating and including "channel.ss.inc"... acuPrep: Reading TIME_SEQUENCE...

95 Page 95 AcuSolve Log File (cont) acuPrep: Reading RUN acuPrep: Processing RUN acuPrep: Processing ANALYSIS... acuPrep: acuPrep: Minimum coordinates = e e e-01 acuPrep: Maximum coordinates = e e e-01 acuPrep: Total nodes = 462 acuPrep: Total elements = 200 acuPrep: Total aggl. rad. surfaces = 0 acuPrep: Total interface surfaces = 0 acuPrep: acuPrep: Output data = Subdomain 0 acuPrep: Output data = Subdomain 1 acuPrep: Output data = Domain decomposition acuPrep: Output data = Surface output acuPrep: acuPrep: Input CPU/Elapse time = e e-02 Sec acuPrep: Proc. CPU/Elapse time = e e-02 Sec acuPrep: Solar CPU/Elapse time = e e+00 Sec acuPrep: DDC CPU/Elapse time = e e-03 Sec acuPrep: Output CPU/Elapse time = e e-02 Sec acuPrep: Total CPU/Elapse time = e e-01 Sec acuPrep: Total Memory Size = e-01 Mbytes

96 Page 96 AcuSolve Log File (cont) acuRun: -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- acuRun: No enclosure radiation found: Bypassing acuView acuRun: -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- acuRun: Run acuSolve... acuRun: setenv MP_SET_NUMTHREADS 2 acuRun: setenv OMP_NUM_THREADS 2 acuRun: setenv OMP_DYNAMIC FALSE acuRun: setenv MPC_GANG OFF acuRun: /usr/acusim/SGI64/latest/bin/acuSolve -np 1 -nt 2 acuSolve: acuSolve: Checked out a license [expiration Jul ] acuSolve: acuSolve: Date = Tue Jun 22 17:41: acuSolve: Problem = channel acuSolve: Run = 1 acuSolve: Title = Laminar channel flow... acuSolve: Input Phase acuSolve: Input CPU/Elapse time = e e-01 Sec acuSolve: Input Memory Usage = e+01 Mbytes acuSolve: Begin Time Step

97 Page 97 AcuSolve Log File (cont) acuSolve: Time-Step= 1 ; timeInc= e+10 ; time= e+00 acuSolve: Flow stagger "flow": FORM-LHS acuSolve: pressure res ratio = e-03 acuSolve: velocity res ratio = e-01 acuSolve: CGP No iterations = 18 acuSolve: CGP 0/1/n norms = e e e-08 acuSolve: GMRES No iterations = 10 (1.00) acuSolve: GMRES 0/1/n norms = e e e-07 acuSolve: pressure sol ratio = e+00 acuSolve: velocity sol ratio = e-01 acuSolve: CFL timeInc = e-01 acuSolve: Step CPU/Elapse time = e e-01 Sec... acuSolve: End Time Step acuSolve: Input CPU/Elapse time= e e-01 Sec acuSolve: Output CPU/Elapse time= e e-02 Sec acuSolve: Exchange CPU/Elapse time= e e-02 Sec acuSolve: Intf.search CPU/Elapse time= e e+00 Sec acuSolve: Flow stagger "flow": acuSolve: No of res/lhs formations = 8 8 acuSolve: Elem.Form CPU/Elapse time= e e-01 Sec acuSolve: Solution CPU/Elapse time= e e-01 Sec acuSolve: Total CPU/Elapse time = e e+00 Sec acuSolve: Total Memory Usage = e+01 Mbytes acuRun: -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- acuRun: Tue Jun 22 17:41:

98 Page 98 Convergence Check Convergence is checked on residual & solution increment ratios Computed separately for each variable/equation Convergence occurs when all measures satisfy tolerance Residual ratio is the norm of residual (out-of-balance forces) normalized by the forces making up the residual It is a local and canonical measure Does not dependent on historical data It is fairly problem independent Solution increment ratio is the norm of the solution increment normalized by the norm of the solution Same properties as residual ratio

99 Page 99 Monitoring Convergence To monitor convergence execute acuMon This requires Java 1.4 installed on your system Alternatively execute acuProbe Available on Windows, LINUX, HP and SGI64 May require special installation

100 Page 100 Signal a Running Job Use acuSig to signal a running acuSolve job Stop a running job at the end of current time step (clean stop) acuSig -stop Stop a running job as soon as possible acuSig -halt Stop a running job after a certain time step is completed acuSig –sts 200 Signal a running job to output its results at the end of current time step acuSig -out Send a value to a USER_GLOBAL_DATA acuSig –data x=45 And many more, do acuSig –help

101 Page 101 User Defined Function User Defined Function (UDF) may be used with commands: Body Force:  GRAVITY  HEAT_SOURCE  SPECIES_SOURCE Material Model:  DENSITY_MODEL  SPECIFIC_HEAT_MODEL  VISCOSITY_MODEL  CONDUCTIVITY_MODEL  DIFFUSIVITY_MODEL  SURFACE_TENSION_MODEL  EMISSIVITY_MODEL

102 Page 102 User Defined Function (cont) Commands using UDF (cont): Multiplier Function:  MULTIPLIER_FUNCTION Mesh Motion:  MESH_MOTION Component Model:  FAN_COMPONENT  HEAT_EXCHANGER_COMPONENT Boundary Conditions:  NODAL_BOUNDARY_CONDITION  ELEMENT_BOUNDARY_CONDITION  PERIODIC_BOUNDARY_CONDITION Output:  ELEMENT_OUTPUT

103 Page 103 User Defined Function (cont) Four steps are needed to use user-defined functions: Write a user-defined function, in C or Fortran (with a C cover function) Reference it in the input file Compile and link the code into a shared library, using  acuMakeLib on UNIX/LINUX  acuMakeDll on Windows Run it  acuRun on either UNIX/LINUX or Windows

104 Page 104 Client Server Example Simple channel flow problem Parabolic inflow velocity is scaled/controlled to achieve a target pressure drop Objectives is to learn and practice: User Defined Function (UDF) Client-server functionality Active flow control using UDF and MULTIPLIER_FUNCTION Get the problem from Note that there are simpler ways of solving this problem

105 Page 105 Client Server Communication Model Assume AcuSolve is running on 4 processor Assume external program is running on 1 processor Processor 1 Processor 2 Processor 3 Processor 4 AcuSolve usrPerl.pl External Program Transparent to the user

106 Page 106 Client Server Input File A Multiplier Function is used as the control mechanism MULTIPLIER_FUNCTION( "inflow pressure control" ) { type= user_function user_function= "usrClientServer" user_values= { 4,# target pressure 1,# initial MF 0 }# verbose user_strings= { "usrPres.pl",# command "inflow" }# surface output evaluation= once_per_time_step } Use an external program usrPres.pl written in Perl in this case On Windows use: "perl usrPres.pl" For remote machines: "rsh eagle usrPres.pl"  You may need the full path Pressure (normal component of traction) is extracted from the surface output "inflow"

107 Page 107 Client Server Input File (cont) Nodal velocity is scaled by the multiplier function NODAL_BOUNDARY_CONDITION( "inflow x-vel" ) { variable = x_velocity type = cubic_spline nodes = Read( "channel.inflow.nbc" ) curve_fit_values = { 0,0 ; 0.5,1 ; 1,0 } curve_fit_variable = y_coordinate multiplier_function = "inflow pressure control" } Pressure is measured by SURFACE_OUTPUT( "inflow" ) { surfaces = Read( "channel.inflow.srf" ) shape = four_node_quad element_set = "interior" integrated_output_frequency = 1 }

108 Page 108 Client Server Input File (cont) Multiplier functions can directly or indirectly affect other multiplier functions USER_GLOBAL_DATA( "inflow pressure control" ) { value = 1 } MULTIPLIER_FUNCTION( "inflow pressure control 2" ) { type = user_global_data user_global_data = "inflow pressure control" dependencies = { "inflow pressure control" } } MULTIPLIER_FUNCTION( "inflow pressure control 3" ) { type = piecewise_linear curve_fit_values = { 0, 0 ; 100, 100 } curve_fit_variable = user_global_data curve_fit_variable_qualifier = "inflow pressure control" dependencies = { "inflow pressure control" } }

109 Page 109 Client Server User Function /**************************************************************************** ** Copyright (c) ACUSIM Software, Inc. ** All rights reserved. ** This source code is confidential and may not be disclosed. ****************************************************************************/ /*=========================================================================== ** ** "usr.c": User Defined Function ** **=========================================================================== */ #include "acusim.h" #include "udf.h" /*=========================================================================== * * Prototype the function * *=========================================================================== */ UDF_PROTOTYPE(usrClientServer) ;

110 Page 110 Client Server User Function (cont) /*=========================================================================== * * "usrClientServer": A client/server example * * Arguments: * udfHd - opaque handle for accessing information * outVec - output vector * nItems - number of items in outVec (=1 in this case) * vecDim - vector dimension of outVec (=1 in this case) * * Input file parameters: * user_values = {,, } * user_strings = {, } * *=========================================================================== */ Void usrClientServer( UdfHd udfHd, Real* outVec, Integer nItems, Integer vecDim ) {

111 Page 111 Client Server User Function (cont) Real mfValue ; /* MF return value */ Real targPres ; /* target pressure */ Real verbose ; /* verbose level */ Real* trac ; /* pointer to surface traction */ Real* usrVals ; /* user supplied values */ String command ; /* execution command */ String inflowOsi ; /* inflow surface output */ String* usrStrs ; /* user supplied strings */ char buffer[1024] ; /* a string buffer */ char* name ; /* name of the UDF */ /* * Get the user data * */ udfCheckNumUsrVals( udfHd, 3 ) ; udfCheckNumUsrStrs( udfHd, 2 ) ; usrVals = udfGetUsrVals( udfHd ) ; usrStrs = udfGetUsrStrs( udfHd ) ; targPres = usrVals[0] ; mfValue = usrVals[1] ; verbose = usrVals[2] ; command = usrStrs[0] ; inflowOsi = usrStrs[1] ;

112 Page 112 Client Server User Function (cont) /* * Start the client * */ if ( udfFirstCall(udfHd) ) { sprintf( buffer, "%s %g %g %g", command, targPres, mfValue, verbose ) ; udfOpenPipePrim( udfHd, buffer ) ; }

113 Page 113 Client Server User Function (cont) /* * Get the data * */ if ( !udfFirstStep(udfHd) ) { trac = udfGetOsiData( udfHd, inflowOsi, UDF_OSI_TRACTION ) ; udfWritePipe( udfHd, "pressure= %.16g", -trac[0] ) ; udfReadPipe( udfHd, buffer, 1024 ) ; sscanf( buffer, "%*s %le", &mfValue ) ; if ( fabs(-trac[0]-targPres) > 1.e-4*fabs(targPres) ) { udfSetSig( udfHd, UDF_SIG_NO_CONV, 0 ) ; } /* * Store the data * */ outVec[0] = mfValue ;

114 Page 114 Client Server User Function (cont) /* * Save the data in a global data * */ name = udfGetName( udfHd ) ; udfCheckUgd( udfHd, name ) ; udfSetUgdData( udfHd, name, mfValue ) ; } /* end of usrClientServer() */

115 Page 115 Client Server Compile/Link On UNIX/LINUX build the shared library by running acuMakeLib On SGI64, this produces results such as acuMakeLib: Creating Makefile... acuMakeLib: Source files = usr.c acuMakeLib: make clean libusr.so rm -f libusr.so usr.o cc -64 -DACUSIM_SGI64 -c -I/usr/acusim/SGI64/latest/include -O usr.c ld -o libusr.so -64 -mips4 -shared -all usr.o -lc -lm Library libusr.so is then opened by acuSolve at run time See option user_libraries of acuSolve or acuRun: acuRun -help | grep user_libraries

116 Page 116 Client Server Compile/Link (cont) On Windows build the shared library by running acuMakeDll This produces results such as acuMakeDll: Using Visual Studio C Compiler acuMakeDll: Using Digital Fortran F77 Compiler acuMakeDll: Source files = usr.c acuMakeDll: Remove objects = usr.obj acuMakeDll: cl -c -DACUSIM_NT "-IC:\Acusim\NT\V1.6\include" -O2 -Oa usr.c Microsoft(R)32-bit C/C++ Optimizing Compiler Version for 80x86 Copyright (C) Microsoft Corp All rights reserved. usr.c acuMakeDll: link -dll -out:libusr.dll usr.obj C:/Acusim/NT/V1.6/bin/acuSolve.lib Microsoft (R) Incremental Linker Version Copyright (C) Microsoft Corp All rights reserved. Creating library libusr.lib and object libusr.exp Library libusr.dll is then opened by acuSolve at run time

117 Page 117 Client Server External Program External program may be written in any language Read AcuSolve generated data as stdin (standard in)  Read one ASCII line at a time Write results to stdout (standard out)  Write one ASCII line at a time  Make sure standard out is flushed Communication prototype (handshake) is up to the user

118 Page 118 Client Server usrPres.pl #!/usr/bin/env perl ##*************************************************************************** ## Copyright (c) ACUSIM Software, Inc. ## All rights reserved. ## This source code is confidential and may not be disclosed. ##*************************************************************************** #=========================================================================== # # "usrPres.pl": User client perl script # #=========================================================================== # Force line buffering #=========================================================================== $| = 1 ;

119 Page 119 Client Server usrPres.pl (cont) #=========================================================================== # Get the parameters #=========================================================================== if ( != 3 ) { die "Usage: $0 target_pressure initValue verbose" ; } $targPres = ; $mf = ; $verbose = ; $atFct = 0.8 ;# attenuation factor

120 Page 120 Client Server usrPres.pl (cont) #=========================================================================== # Loop through steps #=========================================================================== while( <> ) { chomp ; $line = $_ ; if ( $line !~ /\Apressure= (.*)\Z/ ) { die "Invalid line: $_\n" ; } $mfPrev = $mf ;

121 Page 121 Client Server usrPres.pl (cont) #=========================================================================== # Do a continuous and attenuated least-squares fit: #mf = a1 pres + a2 pres^2 #=========================================================================== $p1 = $1 ; $p2 = $p1 * $p1 ; $lhs11 = $atFct * $lhs11 + $p1 * $p1 ; $lhs12 = $atFct * $lhs12 + $p1 * $p2 ; $lhs22 = $atFct * $lhs22 + $p2 * $p2 ; $res1 = $atFct * $res1 + $p1 * $mf ; $res2 = $atFct * $res2 + $p2 * $mf ; $d = $lhs11 * $lhs22 - $lhs12 * $lhs12 ; if ( $d > 1.e-8 * ($lhs11 * $lhs22) ) { $a1 = (+$lhs22 * $res1 - $lhs12 * $res2) / $d ; $a2 = (-$lhs12 * $res1 + $lhs11 * $res2) / $d ; $mf = ($a2 * $targPres + $a1) * $targPres ; } elsif ( $lhs11 > 0 ) { $a1 = $res1 / $lhs11 ; $mf = $a1 * $targPres ; }

122 Page 122 Client Server usrPres.pl (cont) #=========================================================================== # Return the results #=========================================================================== $mf = 2.0 * $mfPrev if $mf > 2.0 * $mfPrev ; $mf = 0.5 * $mfPrev if $mf < 0.5 * $mfPrev ; printf "multiplier_function= %.16g\n", $mf ; print STDERR "pressure = $p1 mf = $mf\n" if $verbose ; }

123 Page 123 Client Server Run To Run acuRun Extract surface integrated fluxes acuTrans –osi –osiv step,mass_flux,traction \ –osis “inflow” –to table

124 Page 124 Restart Simplest way to restart a job: acuRun –rst Starts from the last available restart run/time-step No modification is accommodated Requires having restart files on disk, enable through: RESTART_OUTPUT { output_frequency= 100 num_saved_states= 2 } By default restart files are written every 1000 time steps plus the last time step

125 Page 125 Restart with Modifications Restarting a job from a solved problem with modifications requires: Writing a restart input file; such as channel.rst Running acuRun with the restart input file acuRun -inp channel.rst Restart file starts with RESTART & ends with RUN : RESTART { } needed modifications RUN { } Here the run resumes from the last available restart data

126 Page 126 Restart with Modifications (cont) A problem may be restarted from any available problem, run and time step: RESTART { from_problem= "channel" from_run= 2 from_time_step= 40 } Any number of commands may be placed between RESTART and RUN to change and/or add new options The only restriction is that the number of nodes may not be changed

127 Page 127 Restart with Modifications (cont) Example: to run a steady thermal-flow problem in two steps: Step 1:  Write the initial input file with all flow and thermal conditions (equations, staggers, matrial models, BC, etc.)  Solve for all but temperature equation in step 1: e.g TIME_SEQUENCE {... staggers= { "flow", "turb" } }  Run acuRun with this input file Step 2:  Write a simple restart file, such as RESTART { } TIME_SEQUENCE { staggers= { "temp" } } RUN { }  Run acuRun with this input file

128 Page 128 Concluding Remarks AcuSolve is a general purpose incompressible flow solver It can be used to model a wide range of CFD problems Its differentiation is in its superior: Robustness Speed Accuracy Functionality For further information on using AcuSolve, consult the manuals AcuSolve Command Reference Manual AcuSolve Programs Reference Manual AcuSolve User-Defined Function Reference Manual


Download ppt "ACUSIM Software Inc., 2685 Marine Way, Suite 1215, Mountain View, California 94043 Tel: (650) 988-9700 Fax: (650) 988-9770"

Similar presentations


Ads by Google