Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. fotron 77 to c++ conversion

fotron 77 to c++ conversion

Scheduled Pinned Locked Moved C / C++ / MFC
c++css
11 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nileshb111
    wrote on last edited by
    #1

    I want to covert following program into c++ subroutine gstep common/blk1/u(3,800,800),fnl(3,800,800),gnl(3,800,800) common/blk2/ni,nj,radi,rado,dt,cfl,lod,dto,wn,wl,lexp,dtot,ndiv,pi,phi c in case a global time step is reqd. eg. time accurate problems em=1. ep=1. c=1/sqrt(ep*em) dt=10000. cl=ar/diag do i=1,ni do j=4,nj-3 call grid(i,j,x1,y1,x2,y2,x3,y3,x4,y4,xp1,yp1,ar,c,0) diag=0.5*(sqrt((x1-x3)**2+(y1-y3)**2)+sqrt((x2-x4)**2 * +(y2-y4)**2)) cl=ar/diag dtemp=cfl*cl/(c) if(dtemp.lt.dt)then dt=dtemp endif enddo enddo wl=2*pi/wn write(*,*) wn,wl,dt ndiv=wl/(c*dt) write(*,*) ndiv ndiv=ndiv+1 dt=wl/(c*(ndiv)) write(*,*) ndiv,dt return end

    L 1 Reply Last reply
    0
    • N Nileshb111

      I want to covert following program into c++ subroutine gstep common/blk1/u(3,800,800),fnl(3,800,800),gnl(3,800,800) common/blk2/ni,nj,radi,rado,dt,cfl,lod,dto,wn,wl,lexp,dtot,ndiv,pi,phi c in case a global time step is reqd. eg. time accurate problems em=1. ep=1. c=1/sqrt(ep*em) dt=10000. cl=ar/diag do i=1,ni do j=4,nj-3 call grid(i,j,x1,y1,x2,y2,x3,y3,x4,y4,xp1,yp1,ar,c,0) diag=0.5*(sqrt((x1-x3)**2+(y1-y3)**2)+sqrt((x2-x4)**2 * +(y2-y4)**2)) cl=ar/diag dtemp=cfl*cl/(c) if(dtemp.lt.dt)then dt=dtemp endif enddo enddo wl=2*pi/wn write(*,*) wn,wl,dt ndiv=wl/(c*dt) write(*,*) ndiv ndiv=ndiv+1 dt=wl/(c*(ndiv)) write(*,*) ndiv,dt return end

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      And what is the problem?

      N 2 Replies Last reply
      0
      • L Lost User

        And what is the problem?

        N Offline
        N Offline
        Nileshb111
        wrote on last edited by
        #3

        i have to calculate diagonal using grid points

        L 1 Reply Last reply
        0
        • N Nileshb111

          i have to calculate diagonal using grid points

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          No, I mean what is the programming problem? Telling us what you want to do does not give enough information about where you are stuck or what you have tried. If you know the mathematics of the problem then converting that into C++ code should not be too difficult.

          1 Reply Last reply
          0
          • L Lost User

            And what is the problem?

            N Offline
            N Offline
            Nileshb111
            wrote on last edited by
            #5

            I am writing cfd code taking reference of FORTRAN code following is the code which i had written but this program is not running #include #include #include //#include "constant1.h" using namespace std; float radi=11,rado=59.99,dro; float r=11,spar=0.9415,pi=3.141592654,cfl=0.50,wn=2*pi*0.6/radi; int i=1,ni=200,nj=50,nth=ni,nrad=nj,ncon1=0,ncon2=0,ncon=1000,lod=3,lexp=2,eps=0; //float wn; static int j=1; class project { public: float x,y,r,th; void grid() { fstream infile("grid11.dat",ios::out); for(r=11;r<=60;r++) { for(th=0; th<=2*pi; th=th+((pi/100)+(.00025*pi/98))) { cout<

            L 1 Reply Last reply
            0
            • N Nileshb111

              I am writing cfd code taking reference of FORTRAN code following is the code which i had written but this program is not running #include #include #include //#include "constant1.h" using namespace std; float radi=11,rado=59.99,dro; float r=11,spar=0.9415,pi=3.141592654,cfl=0.50,wn=2*pi*0.6/radi; int i=1,ni=200,nj=50,nth=ni,nrad=nj,ncon1=0,ncon2=0,ncon=1000,lod=3,lexp=2,eps=0; //float wn; static int j=1; class project { public: float x,y,r,th; void grid() { fstream infile("grid11.dat",ios::out); for(r=11;r<=60;r++) { for(th=0; th<=2*pi; th=th+((pi/100)+(.00025*pi/98))) { cout<

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Nileshb111 wrote:

              but this program is not running

              Once again you are expecting us to guess what is happening; we cannot see your screen or read your mind. Please edit your message, add <pre> tags around your code to make it readable, and explain exactly what the problem is and where it occurs.

              N 2 Replies Last reply
              0
              • L Lost User

                Nileshb111 wrote:

                but this program is not running

                Once again you are expecting us to guess what is happening; we cannot see your screen or read your mind. Please edit your message, add <pre> tags around your code to make it readable, and explain exactly what the problem is and where it occurs.

                N Offline
                N Offline
                Nileshb111
                wrote on last edited by
                #7

                I wanted to calculate outgoing flux on 2D circular grid. So first part of this code is for to get grid point after that i initializes variables on those grid points, now i want to calculate diagonal to get unit normal through it . above code running upto global time step

                1 Reply Last reply
                0
                • L Lost User

                  Nileshb111 wrote:

                  but this program is not running

                  Once again you are expecting us to guess what is happening; we cannot see your screen or read your mind. Please edit your message, add <pre> tags around your code to make it readable, and explain exactly what the problem is and where it occurs.

                  N Offline
                  N Offline
                  Nileshb111
                  wrote on last edited by
                  #8

                  please can u help me to solve posted problem

                  L 1 Reply Last reply
                  0
                  • N Nileshb111

                    please can u help me to solve posted problem

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    Not without some proper detail of the code you have written, what it is supposed to do, and what errors you receive.

                    N 1 Reply Last reply
                    0
                    • L Lost User

                      Not without some proper detail of the code you have written, what it is supposed to do, and what errors you receive.

                      N Offline
                      N Offline
                      Nileshb111
                      wrote on last edited by
                      #10

                      Can u give a c++ code to calculate flux over 2D grids please

                      L 1 Reply Last reply
                      0
                      • N Nileshb111

                        Can u give a c++ code to calculate flux over 2D grids please

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #11

                        Nileshb111 wrote:

                        Can u give a c++ code to calculate flux over 2D grids please

                        Sorry, no, particularly as I have no idea what you mean by "calculate flux over 2D grids".

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups