h/t3d_array.h All parameter after T3D__R_PWR needs to be bumped up by one. So integer T3D__NL_V parameter (T3D__NL_V = 40) ! # lines of sight becomes: integer T3D__NL_V parameter (T3D__NL_V = 41) ! # lines of sight Same for all parameters following T3D__NL_V. =========================== lib/t3d_get_grid.h in entry t3d_header: Add a line to set the third scaling factor if it is not BadR4 I = 0 I = I+Str2Str('Power for radial normalization:',cStr(J)(I+1:))+1 I = I+Flt2Str(t3d(T3D__R_PWR ),5,cStr(J)(I+1:))+1 I = I+Flt2Str(t3d(T3D__R_PWR+1),5,cStr(J)(I+1:))+1 ! T3D__R_PWR+2 is used for the normal magnetic field component ! It is set to BadR4 when handling velocity/density if ( t3d(T3D__R_PWR+2) .NE. BadR4()) I = I+Flt2Str(t3d(T3D__R_PWR+2),5,cStr(J)(I+1:)) =========================== lib/t3d_write_bb: Add argument BN3D to argument list, and add a write statement at the end: subroutine T3D_write_bb(cPrefix, t3d, BR3D, BT3D, BN3D, iStrAdd, cStrAdd, cFile) real BN3D(*) call WR2DARR(4,nLng,nLat*nRad,BN3D,cFile,cFmt,.FALSE.,0,cStr(1)) =========================== lib/write3d_bb.f Add argument BN3D to argument list: subroutine Write3D_bb(XC3D,V3D,BR3D,BT3D,BN3D) real BN3D(*) In declaration section, change dimension of PwrR from 2 to 3; then set the 3rd value to Bad before calling T3D_set: real PwrR(3) /2.0,1.0,1.0/ call T3D_set(T3D__R_PWR,3,PwrR ) ! Radial normalization powers Fill BN3D with normal magnetic field component, i.e. somewhere there should be lines like this: BR3D(iP) = BR BT3D(iP) = BT BN3D(iP) = BN Add BN3D to T3D_write_bb call: call T3D_write_bb(B3D__PREFIX(iB), dummy, BR3D, BT3D, BN3D, 0, ' ', cFile) =========================== lib/write3d_nv.f In declaration section, change dimension of PwrR from 2 to 3; then set the 3rd value to Bad before calling T3D_set: real PwrR(3) /0.0,2.0,0.0/ The update T3D_set call that puts PwrR into the header: Bad = BadR4() PwrR(3) = Bad call T3D_set(T3D__R_PWR,3,PwrR) ========================== lib/extractinsitu.f Add argument BN3D to argument list: subroutine ExtractInsitu(bExtract,VV3D,DD3D,BR3D,BT3D,BN3D,nCar,JDCar) real BN3D(*) Modify code to calculate the right BN field to write to file. This currently hardcodes the radial scaling factors. These must be identical to the values set in write3d_bb.f. ========================== Main program will call write3d_bb and extractinsitu. Array BN3D needs to be declared with the same dimensions as BR3D and BT3D.