writeGrid Subroutine

public subroutine writeGrid(fn, vars, x, y, z)

Write a grid to a file

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: fn

Filename

character(len=*), intent(in), dimension(:):: vars

Variable names

real(kind=dp), intent(in), optional dimension(:):: x

Grid data

real(kind=dp), intent(in), optional dimension(:):: y

Grid data

real(kind=dp), intent(in), optional dimension(:):: z

Grid data

Calls

proc~~writegrid~~CallsGraph proc~writegrid writeGrid nf90_put_att nf90_put_att proc~writegrid->nf90_put_att nf90_def_var nf90_def_var proc~writegrid->nf90_def_var nf90_def_dim nf90_def_dim proc~writegrid->nf90_def_dim nf90_enddef nf90_enddef proc~writegrid->nf90_enddef nf90_put_var nf90_put_var proc~writegrid->nf90_put_var nf90_create nf90_create proc~writegrid->nf90_create nf90_close nf90_close proc~writegrid->nf90_close
Help

Called By

proc~~writegrid~~CalledByGraph proc~writegrid writeGrid proc~testwrite testWrite proc~testwrite->proc~writegrid program~testnetcdf_prg testNetCDF_prg program~testnetcdf_prg->proc~testwrite
Help

Source Code


Source Code

	subroutine writeGrid(fn,vars,x,y,z)
		!! Write a grid to a file
		character(*),intent(in)::fn
			!! Filename
		character(*),dimension(:),intent(in)::vars
			!! Variable names
		real(dp),dimension(:),intent(in),optional::x
			!! Grid data
		real(dp),dimension(:),intent(in),optional::y
			!! Grid data
		real(dp),dimension(:),intent(in),optional::z
			!! Grid data
		
		character(100)::p
		integer::c
		integer,dimension(:),allocatable::dims
		integer::f_id
		integer::i_id,j_id,k_id,l_id
		integer::x_id,y_id,z_id,t_id
		integer::v_id
		
		integer::ier
		integer::k
		
		ier = nf90_create(fn,NF90_CLOBBER,f_id)
		ier = nf90_def_dim(f_id,'x',size(x),i_id)
		if(present(y)) ier = nf90_def_dim(f_id,'y',size(y),j_id)
		if(present(z)) ier = nf90_def_dim(f_id,'z',size(z),k_id)
		ier = nf90_def_dim(f_id,'t',NF90_UNLIMITED,l_id)
		
		ier = nf90_def_var(f_id,'x',NF90_DOUBLE,[i_id],x_id)
		if(present(y)) ier = nf90_def_var(f_id,'y',NF90_DOUBLE,[j_id],y_id)
		if(present(z)) ier = nf90_def_var(f_id,'z',NF90_DOUBLE,[k_id],z_id)
		ier = nf90_def_var(f_id,'t',NF90_DOUBLE,[l_id],t_id)
		ier = nf90_put_att(f_id,t_id,'units','seconds since start')
		
		c = 1
		if(present(y)) c = c+10
		if(present(z)) c = c+100
		select case(c)
		case(001)
			dims = [i_id,l_id]
		case(011)
			dims = [i_id,j_id,l_id]
			p = 'yp, product; xp, product'
		case(111)
			dims = [i_id,j_id,k_id,l_id]
		end select
		do k=1,size(vars)
			ier = nf90_def_var(f_id,vars(k),NF90_DOUBLE,dims,v_id)
			ier = nf90_put_att(f_id,v_id,'field',vars(k))
		end do
		
		ier = nf90_enddef(f_id)
		
		ier = nf90_put_var(f_id,x_id,x)
		if(present(y)) ier = nf90_put_var(f_id,y_id,y)
		if(present(z)) ier = nf90_put_var(f_id,z_id,z)
		
		ier = nf90_close(f_id)
	end subroutine writeGrid


abs abs_t acos_t ad_t add_t arg arrayToChar asin_t assignment(=) atan_t bar barh biCGSTAB_t biConjugateGradientStabilized binData box charToArray checkPrecision colorbar colorbar2 colorize colorMap config_t conjg conjugateGradient conjugateGradient_t contour contourf cos_a cos_t cpuTime cubicSpline_t deDup DFT div_t doBar doContour doError doFillBetween doFunction doHist doLegend doLogPlot doPlot doQuiver doScatter doSurface endsWith errorbar eval_test eval_testN evalR_abs evalR_acos evalR_add evalR_asin evalR_atan evalR_cos evalR_div evalR_exp evalR_imag evalR_log evalR_log10 evalR_mul evalR_neg evalR_p evalR_pow evalR_real evalR_sin evalR_sqrt evalR_sub evalR_tan evalR_var evalZ_abs evalZ_acos evalZ_add evalZ_asin evalZ_atan evalZ_cos evalZ_div evalZ_exp evalZ_imag evalZ_log evalZ_log10 evalZ_mul evalZ_neg evalZ_p evalZ_pow evalZ_real evalZ_sin evalZ_sqrt evalZ_sub evalZ_tan evalZ_var exp exp exp_t f FFT FFT_freq figure fillBetween fillBetweenx findInterval flatten function_t gaussSeidel gaussSeidel_t hist iDFT iFFT imag_t intToChar inv jacobi jacobi_t labels legend linearInterp linearSpline_t lineSearch_t linspace log log log10 log10 log10_t log_t makeLogo matmul matmul maxval mean meshGridX meshGridY minimumResidual minval mixval mul_t neg_t newAbs newAcos newAdd newAsin newAtan newCos newDiv newExp newImag newIterator newLog newLog10 newMul newNeg newNodeStack newPow newReal newSin newSparse newSpvec newSqrt newSub newTan newToken newVar nint nodeStack_t norm2 norm2 operator(*) operator(*) operator(*) operator(**) operator(+) operator(+) operator(+) operator(-) operator(-) operator(.d.) operator(.o.) operator(.o.) operator(.oo.) operator(.sx.) operator(.x.) operator(/) operator(/) operator(<) operator(>) plot plot3 pop pow_t printTypes push quat_t quiver randomNormal randomUniform readGrid readStep real_t realToChar realToTime removeSpaces scaler scatter setRandomSeed setup show showProgress sin_a sin_t solveLU solveLU solverProgress SOR_t span sqrt sqrt_t startReport startsWith stDev steepestDescent sub_t subplot successiveOverRelaxation sum sum surface symmetricGaussSeidel symmetricSuccessiveOverRelaxation tan_a tan_t TDMA TDMA testBasic testBasicSolvers testColorize testColorMap testConstants testCpuTime testDeDup testDiff testDot testEndsWith testFFT testFlatten testFunction testIFFT testIntToChar testLinearInterp testLinspace testLU testMean testMeshGrid testMixval testNewConfig testNewSparse testNewSpline testNext testObjective testObjectiveN testPlot testPrecision testRandomNormal testRandomUniform testRead testReadGmsh testRealToChar testRealToTime testRemoveSpaces testSetRandomSeed testSolvers testSpan testSplineX testSpvec testStartsWith testStDev testTDMA testWallTime testWrite testWriteMat testWriteVTK testWriteVTK ticks title token_t tokenize toRPN transpose v2m var_t vector wait wallTime wireframe writeGrid writeGridVTK writeHeaderVTK writeMat writeScalarVTK writeStep writeVectorVTK xlabel xlim xticks xylim xyzlim ylabel ylim yticks