You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Unable to render {include} The included page could not be found.

implementation steps

We will implement running of Sobek through a dll using the following approach:

Extend fortran code to allow for setting model parameters and data (ie "setvalues")
In C# the module wlacces implements running of sobek models that are defined in a file.

setvalues will be defined in new interface (not in iwlaccess !)
fortran c / code will implement methods in interface

Steps to follow

step 1
Convert cf_openmi to vs2005 sln (debugging fortran will be easier and is a requirement)

step 2
Define derived types for 1d model:

  • Network
    Type Network
    int nNodes
    Node Nodes nNodes
    int nBranches
    Branch Branches []
    End Type

Type Node
End Type

Type Branch
End Type

  • Model parameters
  • Boundary Conditions
  • Initial Conditions
  • Structures
  • Output variables

step 3
create an adapter inside cf_openmi with an interface to 1d model with at least the following kind of methods:
-setnetwork
-setboundaryandinitial
-setparameters

we want our c# model to look like this (user friendly)

        [Test]
        public void RunSobek()
        {
            double startTime = 0.0;
            double endTime = 10.0;
            double timeStep = 1.0;

            Model1D.Initialize();

            // create simple network
            //
            // n1           n2             n3
            // x|----|--------|x|-------------|x
            //      r1             r2
            //

            Model1D.SetBranches(...);
            Model1D.SetGridSteps(...);
            
            Model1D.SetRunTimeParameter(startTime, endTime, timeStep);
            
            Model1D.RunTimeStep();

            double time = Model1D.GetCurrentTime();

            Assert.AreEqual(1.0, time);
        }

 

see similar implementation for modflow

examples

Notes

  1. Sobek OpenMI module: 
    Useful function for initialising and performing one or more timesteps and finalizing.
    •  'SE_OpenMI.f90' communicates with OEM buffer.
    • 'SE_OpenMI.f90' has calls to module OMI_CF_control in (OMI_CF_control.f90), which in turn calls directly sobeksim subroutines
  1. Present SOBEK reads nefis files during initialisation (using m_nefisinput.mod). Nefis is used in subroutines: read_initial_values_strpar_etc, soedef, sogetm and wetcrs.
  • No labels