C INTERNATIONAL AVS CENTER C (This disclaimer must remain at the top of all files) C C WARRANTY DISCLAIMER C C This module and the files associated with it are distributed free of charge. C It is placed in the public domain and permission is granted for anyone to use, C duplicate, modify, and redistribute it unless otherwise noted. Some modules C may be copyrighted. You agree to abide by the conditions also included in C the AVS Licensing Agreement, version 1.0, located in the main module C directory located at the International AVS Center ftp site and to include C the AVS Licensing Agreement when you distribute any files downloaded from C that site. C C The International AVS Center, MCNC, the AVS Consortium and the individual C submitting the module and files associated with said module provide absolutely C NO WARRANTY OF ANY KIND with respect to this software. The entire risk as to C the quality and performance of this software is with the user. IN NO EVENT C WILL The International AVS Center, MCNC, the AVS Consortium and the individual C submitting the module and files associated with said module BE LIABLE TO C ANYONE FOR ANY DAMAGES ARISING FROM THE USE OF THIS SOFTWARE, INCLUDING, C WITHOUT LIMITATION, DAMAGES RESULTING FROM LOST DATA OR LOST PROFITS, OR ANY C SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES. C C This AVS module and associated files are public domain software unless C otherwise noted. Permission is hereby granted to do whatever you like with C it, subject to the conditions that may exist in copyrighted materials. Should C you wish to make a contribution toward the improvement, modification, or C general performance of this module, please send us your comments: why you C liked or disliked it, how you use it, and most important, how it helps your C work. We will receive your comments at avs@ncsc.org. C C Please send AVS module bug reports to avs@ncsc.org. C C AVS MODULE RIVER BED C by Terry Myerson C International AVS Center C North Carolina Supercomputing Center C C This module is used to construct the outline of a river C bed. The length parameter specifies the length of the C river in grid cells and cooridinates. The river starts C at y coordinate 0 and extends downward to y coordinate C length at y index length. The river is constructed in the C xy plane. Width specifies the width of the river in the C x direction in grid cells. Width has nothing to do with C the shape of the river. The outline of the river is assumed C to be a sinusoidal function of the form A * Sin (wt) + O C A - Amplitude w - Omega t - Length O - Offset C The data set that is constructed is filled with 0's C This module subroutine is meant to hook up to the C river fill coroutine to create a simulation of river C contaminants. subroutine AVSinit_modules C IAC CODE CHANGE : include '/usr/avs/include/avs.inc' INCLUDE '/usr/avs/include/avs.inc' external river_compute integer iparm call AVSset_module_name('river bed', 'data') call AVSset_module_flags( single_arg_data ) oport = AVScreate_output_port('field', * 'field 3D scalar real 3-space') call AVSautofree_output(oport) iparm = AVSadd_parameter('depth','integer',1,1,100) iparm = AVSadd_parameter('length','integer',30,1,100) iparm = AVSadd_parameter('width','integer',7,1,10) iparm = AVSadd_parameter('omega','real',2.5,0.0,5.0) iparm = AVSadd_parameter('amplitude','real',1.0,0.0,10.0) iparm = AVSadd_parameter('offset','integer',5,0,100) call AVSset_compute_proc(river_compute) return end integer function river_compute(output_field, * depth,length,width,omega,amplitude,offset ) C IAC CODE CHANGE : include '/usr/avs/include/avs.inc' INCLUDE '/usr/avs/include/avs.inc' integer output_field, length,width,offset,depth real omega,amplitude external river_field integer dims, coordflag, iresult, river_field integer ofield, ocoords, pfield, pcoords real field_data, coords dimension field_data(1), coords(1), dims(3) dims(1) = width dims(2) = length dims(3) = depth print *,depth output_field = AVSdata_alloc( & 'field 3D irregular scalar real 3-space', dims) if (output_field .eq. 0) then write(6,90) field_descriptor 90 format('Error allocating field ',A) river_compute=0 return endif iresult = AVSfield_data_offset(output_field, field_data, ofield) iresult = AVSfield_points_offset(output_field, coords, ocoords) iresult=river_field(field_data(ofield+1),depth, * length,width,coords(ocoords+1),omega,amplitude,offset ) river_compute = iresult return end C ******************************************************************* integer function river_field(field_data, * depth,length,width,coords,omega,amplitude,offset ) C IAC CODE CHANGE : include '/usr/avs/include/avs.inc' INCLUDE '/usr/avs/include/avs.inc' integer depth,length,width,offset real field_data(width,length,depth),coords(width,length,depth,3) real omega,amplitude real func,frac do 10 k=1,depth do 10 j=1,length func = amplitude*sin(omega*j)+offset do 10 i=1,width frac = 2*func/width*i field_data(i,j,k) = 0.0 coords(i,j,k,1) = -1*func+frac coords(i,j,k,2) = -1.0*float(j) coords(i,j,k,3) = k 10 continue river_field=1 return end