Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

Example 2

  • Last UpdatedFeb 09, 2023
  • 10 minute read

This example is based on part of the acceptance test and calls several of the auxiliary routines (D3QMEM, D3QSIT ). The FORTRAN code for those routines (provided in source form; see Auxiliary Subroutine Library) may be studied in conjunction with the bare application code:

C-------------------

PROGRAM EXMPL2

C-------------------

LOGICAL

PROJIN, MDBIN

C

Optional declarations

INTEGER

IFINDM

EXTERNAL

PROJIN, MDBIN, DECCHK, D3FIN, D3FEND

IFINDM = 0

C

Project entry

IF ( .NOT. PROJIN() ) GOTO 12345

C

MDB selection

IF ( .NOT. MDBIN() ) GOTO 12345

C

Design db test

CALL DECCHK

C

Exit

12345 CONTINUE

CALL D3FIN( IFINDM )

CALL D3FEND

END

C------------------------------

LOGICAL FUNCTION PROJIN()

C------------------------------

CHARACTER*1

TEXT

C

Optional declarations

INTEGER

IERR

EXTERNAL

D3INIT, D3EMSG

PRINT*, 'Enter project'

CALL D3INIT( 'DAR', 'SYSTEM', 'XXXXXX', 'NONE', ' ', IERR

PROJIN = IERR.EQ.0

CALL D3EMSG( IERR, .TRUE., TEXT )

RETURN

END

C-----------------------------

LOGICAL FUNCTION MDBIN()

C-----------------------------

CHARACTER*50

TEXT

C

Optional declarations

INTEGER

IERR

EXTERNAL

D3MMDB, D3EMSG

PRINT*, 'Select MDB'

CALL D3MMDB( '/PLANT', ' ', IERR )

MDBIN = IERR.EQ.0

CALL D3EMSG( IERR, .TRUE., TEXT )

RETURN

END

C----------------------

SUBROUTINE DECCHK

C----------------------

CHARACTER*50

TEXT, NAMES(100)

CHARACTER*6

TYPES(100), TYPE, HCON, TCON, FLOW, LNTP

LOGICAL

LOCK, BUIL, LHEA, LTAI, DETA, SHOP, LSTR

LOGICAL

ORIL, POSI, LOFF

CHARACTER*50

NAME, OWNE, MATR

CHARACTER*50

FLUR, CASR, PSPE, ISPE, TSPE

CHARACTER*50

HSTU, HREF, TREF, SPRE, CATR, LSTU, CREF

CHARACTER*120

DUTY, DSCO, PTSP, INSC, FUNC

INTEGER

REV , EREC, CCEN, CCLA, SAFC

INTEGER

LEVE(2), OBST, ARRI

INTEGER

D3XLEN

REAL

HPOS(3), HDIR(3), TPOS(3), TDIR(3), POS(9)

REAL

ORI(3), ANGL

C

Optional declarations

INTEGER

ISIZ, IERR, LEAV, IDISP

REAL

XLEN, YLEN, ZLEN, HEIG, RADI

REAL

BORE, HBOR, TBOR, TEMP, PRES

EXTERNAL

D3MNAM, D3MNUM, D3UMON, D3RPAT, D3MREL, D3RORL

EXTERNAL

D3RPRL, D3EMSG

EXTERNAL

D3QMEM, D3QSIT, D3XLEN, D3QZON, D3QPIP, D3QBRA

EXTERNAL

D3QTEE, D3QELB, D3QEQU, D3QBOX, D3QNOZ, D3MMDB

PRINT*, ' '

PRINT*, 'Design Database Example'

PRINT*, '-----------------------'

PRINT*, ' '

IDISP = 2

PRINT*, 'Select default db type'

CALL D3MMDB( 'DESIGN/PLANT', ' ', IERR )

IF ( IERR .NE. 0 ) THEN

PRINT*, 'Should have succeeded'

PRINT*, 'Instead error is:'

GOTO 12345

ENDIF

C

Look at world

CALL D3QMEM( IDISP, 100, TYPES, NAMES, ISIZ, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

C

Look at site

CALL D3MNAM( '/EQU', IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3QMEM( IDISP, 100, TYPES, NAMES, ISIZ, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

CALL D3QSIT( IDISP, TYPE, NAME, OWNE, LOCK, POS, ORI, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

IF ( NAME .NE. '/EQU' ) THEN

PRINT*, 'Expecting name /EQU got ', NAME(:D3XLEN(NAME))

GOTO 12345

ENDIF

C

Look at zone

CALL D3MNUM( 'zone', 3, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3QMEM( IDISP, 100, TYPES, NAMES, ISIZ, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

CALL D3QZON( IDISP, TYPE, NAME, OWNE, LOCK, POS, ORI, PSPE,

+

ISPE, TSPE, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

IF ( NAME .NE. '/EQ3' ) THEN

PRINT*, 'Expecting name /EQU got ', NAME(:D3XLEN(NAME))

GOTO 12345

ENDIF

PRINT*, ' '

C

Pipe details

CALL D3MNAM( '/250-B-5', IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3QMEM( IDISP, 100, TYPES, NAMES, ISIZ, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

CALL D3QPIP( IDISP, TYPE, NAME, OWNE, LOCK, BUIL, SHOP,

+

BORE, TEMP, PRES, PSPE, ISPE, TSPE, MATR,

+

FLUR, CASR, CCEN, CCLA, DUTY, LNTP, EREC,

+

REV, DSCO, PTSP, INSC, SAFC, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

IF ( NAME .NE. '/250-B-5' ) THEN

PRINT*,'Expecting name /250-B-5 got ', NAME(:D3XLEN(NAME))

GOTO 12345

ENDIF

C

Branch details

CALL D3MNUM( 'BRAN', 1, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3QMEM( IDISP, 100, TYPES, NAMES, ISIZ, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

CALL D3QBRA( IDISP, TYPE, NAME, OWNE, LOCK, BUIL, LHEA,

+

LTAI, DETA, SHOP, LSTR, LNTP, EREC, HBOR,

+

TBOR, HCON, TCON, TEMP, PRES, FLOW, MATR,

+

FLUR, CASR, PSPE, ISPE, TSPE, CCEN, CCLA,

+

DUTY, DSCO, PTSP, INSC, SAFC, HSTU, HREF,

+

TREF, HPOS, HDIR, TPOS, TDIR, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

IF ( NAME .NE. '/250-B-5/1' ) THEN

PRINT*,'Expecting name /250-B-5/1 got ',NAME(:D3XLEN(NAME))

GOTO 12345

ENDIF

C

Branch PPoints with Monitoring

CALL D3UMON( 'FULL' )

CALL D3RPAT( 'PH', '/EQ3', POS(1), POS(4), BORE, HCON, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3RPAT('ptail','worl',POS(1), POS(4), BORE, HCON, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3UMON( 'NONE' )

C

Tee details

CALL D3MREL( 'FIRS', 'TEE', IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3QTEE( IDISP, TYPE, NAME, OWNE, LOCK, POS , ORI ,

+

SPRE, LSTU, CREF, ARRI, LEAV, ANGL, HEIG,

+

RADI, BUIL, SHOP, ORIL, POSI, LOFF, ISPE,

+

TSPE, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

C

Elbow details

CALL D3MREL( 'PREV', 'ELBOW', IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3QELB( IDISP, TYPE, NAME, OWNE, LOCK, POS , ORI ,

+

SPRE, LSTU, CREF, ARRI, LEAV, ANGL, RADI,

+

BUIL, SHOP, ORIL, POSI, ISPE, TSPE, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

C

Elbo PPoints with Monitoring

CALL D3UMON( 'FULL' )

CALL D3RPAT( 'P1', 'WORL', POS(1), POS(4), BORE, HCON, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3RPAT( 'P2', 'WORL', POS(1), POS(4), BORE, HCON, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3UMON( 'NONE' )

PRINT*, ' '

C

Equi details

CALL D3MNAM( '/1501B', IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3QMEM( IDISP, 100, TYPES, NAMES, ISIZ, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

CALL D3QEQU( IDISP, TYPE, NAME, OWNE, LOCK, FUNC, DSCO,

+

PTSP, INSC, POS, ORI, ISPE, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

IF ( NAME .NE. '/1501B' ) THEN

PRINT*, ' Expecting name /1501B got ', NAME(:D3XLEN(NAME))

GOTO 12345

ENDIF

C

Switch on Monitoring and check Pos and Ori

CALL D3UMON( 'FULL' )

CALL D3RORL( 'owne', POS, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3RORL( 'WORL', POS, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3RPRL( 'ZONE', POS, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3RPRL( '/EQU', POS, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3UMON( 'NONE' )

PRINT*, ' '

C

Box details

CALL D3MREL( 'FIRS', 'BOX', IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3QBOX( IDISP, TYPE, NAME, OWNE, LOCK, XLEN, YLEN,

+

ZLEN, POS, ORI, LEVE, OBST, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

C

Box PPoints with Monitoring

CALL D3UMON( 'FULL' )

CALL D3RPAT( 'P1', 'OWNE', POS(1), POS(4), BORE, HCON, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3RPAT( 'P2', 'WORL', POS(1), POS(4), BORE, HCON, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3UMON( 'NONE' )

PRINT*, ' '

C

Nozzle details

CALL D3MREL( 'next', 'nozz', IERR )

IF ( IERR .NE. 0 ) GOTO 12345

CALL D3QNOZ( IDISP, TYPE, NAME, OWNE, LOCK, TEMP, PRES,

+

POS, ORI, CREF, CATR, ANGL, HEIG, RADI, DUTY,

+

ISPE, IERR )

IF ( IERR .NE. 0 ) GOTO 12345

PRINT*, ' '

12345 CONTINUE

CALL D3UMON('NONE')

CALL D3EMSG( IERR, .TRUE., TEXT )

RETURN

END

The output from this example is as follows. Messages 'Entering D3Q...' and 'Exiting D3Q...' result from setting the display flag (first argument of D3Q routines) to 2.

Enter project

PDMS DARs <version details>

<copyright statement>

<site data>

Select MDB

Success

Design Database Example

-----------------------

Select default db type

Entering D3QMEM

Members of WORL

/*

1

SITE

/NEGATIVE-SITE

2

SITE

/DIMENSION-SITE

3

SITE

/VOLCAL.SITE

4

SITE

/EX1-SITE

5

SITE

/HANG-SITE

6

SITE

/CIVIL

7

SITE

/INTEST-SITE

8

SITE

/EQU

9

SITE

/OBSTR

10

GPWL

/GW1

Exiting D3QMEM

Entering D3QMEM

Members of SITE

/EQU

1

ZONE

/EQ1

2

ZONE

/EQ2

3

ZONE

/EQ3

Exiting D3QMEM

Entering D3QSIT

Attributes of SITE

/EQU

Entering D3QCMA

TYPE

SITE

NAME

/EQU

OWNE

/*

LOCK

F

Exiting D3QCMA

POS

0.0000000E+00

0.0000000E+00

0.0000000E+00

ORI

0.0000000E+00

0.0000000E+00

0.0000000E+00

Exiting D3QSIT

Entering D3QMEM

Members of ZONE

/EQ3

1

EQUI

/EQUIP-FALL

2

PIPE

/FALL

3

PIPE

/100-B-2

4

PIPE

/50-W-3000

5

PIPE

/50-WD-2400

6

PIPE

/50-W1-3400

7

PIPE

/80-S12-1400

8

PIPE

/200-N12-1000

9

PIPE

/50-N12-1800

10

PIPE

/150-W12-2000

11

PIPE

/150-W12-2200

12

PIPE

/100-C-12

13

PIPE

/100-C-13

14

PIPE

/150-A-57

15

PIPE

/150-A-3

16

PIPE

/40-B-10

17

PIPE

/80-A-11

18

PIPE

/80-B-14

19

PIPE

/100-B-1

20

PIPE

/80-B-7

21

PIPE

/150-B-6

22

PIPE

/100-B-8

23

PIPE

/50-B-9

24

PIPE

/200-B-4

25

PIPE

/250-B-5

Exiting D3QMEM

Entering D3QZON

Attributes of ZONE /EQ3

Entering D3QCMA

TYPE

ZONE

NAME

/EQ3

OWNE

/EQU

LOCK

F

Exiting D3QCMA

POS

0.0000000E+00

0.0000000E+00

100000.0

ORI

0.0000000E+00

0.0000000E+00

0.0000000E+00

PSPE

=0/0

ISPE

=0/0

TSPE

=0/0

Exiting D3QZON

Entering D3QMEM

Members of PIPE

/250-B-5

1

BRAN

/250-B-5/1

2

BRAN

/250-B-5/2

Exiting D3QMEM

Entering D3QPIP

Attributes of PIPE

/250-B-5

Entering D3QBPA

Entering D3QCMA

TYPE

PIPE

NAME

/250-B-5

OWNE

/EQ3

LOCK

F

Exiting D3QCMA

BUIL

F

SHOP

F

TEMP

-100000.0

PRES

0.0000000E+00

PSPE

/A3B

ISPE

=0/0

TSPE

=0/0

MATR

=0/0

FLUR

=0/0

CASR

=0/0

CCEN

0

CCLA

0

DUTY

Unset

LNTP

Unset

EREC

0

DSCO

Unset

PTSP

Unset

INSC

Unset

SAFC

0

Exiting D3QBPA

BORE

0.0000000E+00

REV

-1

Exiting D3QPIP

Entering D3QMEM

Members of BRAN

/250-B-5/1

1

GASK

=8196/556

2

FLAN

=8196/557

3

ELBO

=8196/558

4

ELBO

=8196/559

5

REDU

=8196/560

6

TEE

/250-B-5/1-T1

7

REDU

=8196/562

8

ELBO

=8196/563

9

ELBO

=8196/564

10

FLAN

=8196/565

11

GASK

=8196/566

Exiting D3QMEM

Entering D3QBRA

Attributes of BRAN

/250-B-5/1

Entering D3QBPA

Entering D3QCMA

TYPE

BRAN

NAME

/250-B-5/1

OWNE

/250-B-5

LOCK

F

Exiting D3QCMA

BUIL

T

SHOP

T

TEMP

466.0000

PRES

340.0000

PSPE

/A3B

ISPE

=0/0

TSPE

=0/0

MATR

=0/0

FLUR

=0/0

CASR

=0/0

CCEN

0

CCLA

0

DUTY

Unset

LNTP

Unset

EREC

0

DSCO

Unset

PTSP

Unset

INSC

Unset

SAFC

0

Exiting D3QBPA

LHEA

T

LTAI

T

DETA

F

LSTR

F

HBOR

200.0000

TBOR

200.0000

HCON

FGD

TCON

FGD

FLOW

Unset

HSTU

/A3B/200P

HREF

/1301-S2

TREF

/1301-S3

HPOS

-319150.0

297760.0

2105.000

HDIR

0.0000000E+00

0.0000000E+00

1.000000

TPOS

-319150.0

302640.0

2105.000

TDIR

0.0000000E+00

0.0000000E+00

1.000000

Exiting D3QBRA

Exiting subroutine D3UMON

Entering subroutine D3RPAT

Input arguments:

PPoint number

PH

Coordinate system

/EQ3

Exiting subroutine D3RPAT

Output arguments:

Position E -319150

N 297760

U 2105

Direction unit vector E 0 N 0 U 1

Bore

200

Connection type

FGD

Error code

0

Entering subroutine D3RPAT

Input arguments:

PPoint number

ptail

Coordinate system

worl

Exiting subroutine D3RPAT

Output arguments:

Position E -319150

N 302640

U 102105

Direction unit vector  E 0 N 0 U 1

Bore

200

Connection type

FGD

Error code

0

Entering subroutine D3UMON

Input arguments:

Monitoring level

NONE

Entering D3QTEE

Attributes of TEE

/250-B-5/1-T1

Entering D3QCPA

Entering D3QCMA

TYPE

TEE

NAME

/250-B-5/1-T1

OWNE

/250-B-5/1

LOCK

F

Exiting D3QCMA

POS

-318315.3

300229.6

3886.000

ORI

0.0000000E+00

0.0000000E+00

0.0000000E+00

SPRE

/A3B/250T

LSTU

=0/0

BUIL

F

SHOP

F

ORIFL

T

POSFL

T

ISPE

=0/0

TSPE

=0/0

Exiting D3QCPA

CREF

/250-B-5/2

ANGL

90.00000

HEIG

0.0000000E+00

RADI

0.0000000E+00

LOFF

F

Exiting D3QTEE

Entering D3QELB

Attributes of ELBO =8196/559

Entering D3QCPA

Entering D3QCMA

TYPE

ELBO

NAME

=8196/559

OWNE

/250-B-5/1

LOCK

F

Exiting D3QCMA

POS

-318315.3

297759.1

3885.950

ORI

180.0000

0.0000000E+00

90.00000

SPRE

/A3B/200EL

LSTU

/A3B/200P

BUIL

F

SHOP

F

ORIFL

T

POSFL

T

ISPE

=0/0

TSPE

=0/0

Exiting D3QCPA

CREF

=0/0

ANGL

90.00000

RADI

0.0000000E+00

Exiting D3QELB

Exiting subroutine D3UMON

Entering subroutine D3RPAT

Input arguments:

PPoint number

P1

Coordinate system

WORL

Exiting subroutine D3RPAT

Output arguments:

Position E -318620

N 297759

U 103886

Direction unit vector

E -1 N 0 U 0

Bore

200

Connection type

BWD

Error code

0

Entering subroutine D3RPAT

Input arguments:

PPoint number

P2

Coordinate system

WORL

Exiting subroutine D3RPAT

Output arguments:

Position E -318315

N 298064

U 103886

Direction unit vector

E 0 N 1 U 0

Bore

200

Connection type

BWD

Error code

0

Entering subroutine D3UMON

Input arguments:

Monitoring level

NONE

Entering D3QMEM

Members of EQUI

/1501B

1

BOX

=8196/151

2

PYRA

=8196/152

3

CYLI

=8196/153

4

CYLI

=8196/154

5

RTOR

=8196/155

6

NOZZ

/1501B-SUCT

7

NOZZ

/1501B-DISC

Exiting D3QMEM

Entering D3QEQU

Attributes of EQUI

/1501B

Entering D3QCMA

TYPE

EQUI

NAME

/1501B

OWNE

/EQ2

LOCK

F

Exiting D3QCMA

FUNC

Unset

DSCO

Unset

PTSP

Unset

INSC

Unset

POS

-314490.0

303145.0

340.0000

ORI

0.0000000E+00

0.0000000E+00

180.0000

ISPE

=0/0

Exiting D3QEQU

Exiting subroutine D3UMON

Entering subroutine D3RORL

Input arguments:

Coordinate system

owne

Exiting subroutine D3RORL

Output arguments:

Orientation unit vectors

X axis

E -1 N 0 U 0

Y axis

E 0 N -1 U 0

Z axis

E 0 N 0 U 1

Error code

0

Entering subroutine D3RORL

Input arguments:

Coordinate system

WORL

Exiting subroutine D3RORL

Output arguments:

Orientation unit vectors

X axis

E -1 N 0 U 0

Y axis

E 0 N -1 U 0

Z axis

E 0 N 0 U 1

Error code

0

Entering subroutine D3RPRL

Input arguments:

Coordinate system

ZONE

Exiting subroutine D3RPRL

Output arguments:

Position E -314490

N 303145

U 340

Error code

0

Entering subroutine D3RPRL

Input arguments:

Coordinate system

/EQU

Exiting subroutine D3RPRL

Output arguments:

Position E -314490

N 303145

U 100645

Error code

0

Entering subroutine D3UMON

Input arguments:

Monitoring level

NONE

Entering D3QBOX

Attributes of BOX

=8196/151

Entering D3QCMA

TYPE

BOX

NAME

=8196/151

OWNE

/1501B

LOCK

F

Exiting D3QCMA

XLEN

510.0000

YLEN

1390.000

ZLEN

110.0000

POS

0.0000000E+00

-676.0000

-285.0000

ORI

0.0000000E+00

0.0000000E+00

0.0000000E+00

LEVE

0

10

OBST

2

Exiting D3QBOX

Exiting subroutine D3UMON

Entering subroutine D3RPAT

Input arguments:

PPoint number

P1

Coordinate system

OWNE

Exiting subroutine D3RPAT

Output arguments:

Position

E 255 N -676 U -285

Direction unit vector E 1 N 0 U 0

Bore

0

Connection type

Error code

0

Entering subroutine D3RPAT

Input arguments:

PPoint number

P2

Coordinate system

WORL

Exiting subroutine D3RPAT

Output arguments:

Position

E -314490 N 303126 U 100360

Direction unit vector  E 0 N -1 U 0

Bore

0

Connection type

Error code

0

Entering subroutine D3UMON

Input arguments:

Monitoring level

NONE

Entering D3QNOZ

Attributes of NOZZ

/1501B-SUCT

Entering D3QCMA

TYPE

NOZZ

NAME

/1501B-SUCT

OWNE

/1501B

LOCK

F

Exiting D3QCMA

TEMP

-100000.0

PRES

0.0000000E+00

POS

0.0000000E+00

0.0000000E+00

0.0000000E+00

ORI

0.0000000E+00

0.0000000E+00

180.0000

CREF

/100-B-8/1

CATR

/NFAAPAMM

ANGL

90.00000

HEIG

100.0000

RADI

0.0000000E+00

DUTY

Unset

ISPE

=0/0

Exiting D3QNOZ

Success

TitleResults for “How to create a CRG?”Also Available in