[ < ] [ > ]   [Contents] [Index] [ ? ]

3.3 Describing 1D gridded model

Specific macros have been built that allow generic description of 1D gridded models. Because of the necessity of defining left and right limiting conditions, the models are partitionned in three groups for cell and transfer components. In the following example, a chain of masselottes linked by springs and dumps is bounded to a wall on the left, and open at right. The TEF formulation of the problem is written in the phase space (position-shift, velocity) for node k, with bounding conditions:

{    pos    vel
  ∂tηk  = ηk
  ∂tηvkel= (φspkr- φspk+r1 + φdkmp- φdmk+p1 )∕mk
{  spr       pos   pos
  φk  = - kk(ηk  - ηk-1)
  φskpr= - dk(ηvkel- ηvek-l1)
(   pos
||||  η0  = 0
{   ηv0el= 0
|| φsNp+r1 = 0
||(  dmp
  φN+1 = 0

where mk is the mass of node k, rk and dk the rigidity of springs and dumping coefficients. There are N nodes in the grid, from 1 to N, and two nodes outside of the grid, a limiting node 0, and a limiting node N + 1. The limiting node corresponding with node 0 is called the down node, while the limiting node corresponding with node N + 1 is called the up node. Other models not part of the 1D grid may be added if any.

To enable 1D gridded models, one should set the select flag ‘grid1d’. In cmz it is achieved setting the select flag in ‘selseq.kumac’, like

 
sel grid1d

With make, the SEL variable should contain grid1d. For example to select grid1d and monitor, it could be

 
SEL = grid1d,monitor

[ < ] [ > ]   [Contents] [Index] [ ? ]

3.3.1 Setting dimensions for 1D gridded model

In that case the number of nodes, the number of states and tranferts per node, and the number of limiting transfers and states are required. These dimensions has to be entered in the ‘DimEtaPhi’ sequence. The parameters for cells are

n_node

Number of cell nodes in the 1D grid.

n_dwn

Number of limiting cells with index -1, i.e. number of cells in the limiting down node.

n_up

Number of limiting cells with index +1, i.e. number of cells in the limiting up node.

n_mult

Number of cells in each node (multiplicity).

The parameters for transfers, are similarly m_node, m_dwn, m_up, m_mult. The layout of their declaration should be respected as the precompiler matches the line. Also this procedure is tedious, it should be selected for debuging processes (use the flag sel dimetaphi in “selsequ.kumac”. Otherwise, the dimensioning sequence will be automaticaly generated, which is smart but can lead to diffculty in interpreting syntax errors. Once a model is correctly entred, turn off the sel flag and further modifications will automatically generate the proper dimensions. The correctness of dimensionning should nevertheless always be checked in principal.f, where you can also check that null valued parameters as lp, mobs, nxp will suppress parts of the code - this is signaled as Fortran comment cards.

In our example, there are three grids of cell and transfer variables (n_node=m_node=3). There are two cells and two transfers in each node (n_mult=2 and m_mult=2). There is no limiting condition for the states in the down node therefore n_up=0. There is no transfer for the first limiting node, and therefore m_dwn=0. There are two states in the limiting node 0, the down node, n_dwn=2, and two transfers in the limiting last node the node up, and m_up=2:

 
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! nodes parameters, and Limiting Conditions (Low and High)
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      parameter (n_node=3,n_dwn=2,n_up=0,n_mult=2);
      parameter (m_node=3,m_dwn=0,m_up=2,m_mult=2);
! ________________________________________________________

[ < ] [ > ]   [Contents] [Index] [ ? ]

3.3.2 1D gridded Model coding

The model code and parameters go in the ‘zinit’ sequence.

Parameters

A value for the Miniker parameters and the model parameters should be given in ‘zinit’, in our example we have

 
!%%%%%%%%%%%%%%%%%%%%%%
! Parameters
!%%%%%%%%%%%%%%%%%%%%%%
real rk(n_node),rd(n_node),rmassm1(n_node);

data rk/n_node*1./;
data rd/n_node*0.1/;
data rmassm1/n_node*1./;
     dt=.01;
     nstep=5 000;
     modzprint = 1000;
     time=0.;

Limiting conditions

There are four mortran blocks for node and up and down, both for states and transfers:

set_dwn_eta

down node cells

set_up_eta

up node cells

set_dwn_phi

down node transfers

set_up_phi

up node transfers

The following scheme illustrates the example:

 
!%%%%%%%%%%%%%%%%%%%%%%%%%%================================================
! Maillage convention inode
!%%%%%%%%%%%%%%%%%%%%%%%%%%                                 Open ended
!(2 Down    Phi    Eta                         (n_node)
! Eta)  \|       .-----.       .-----.          .-----.        /
! wall  \|-\/\/\-|     |-\/\/\-|     |  . . .  -|     |-\/\/\- |dummy
!  pos  \|--***--|  1  |--***--|  2  |  . . .  -|  n  |--***-- |Phis
! speed \|   1   |_____|   2   |_____|      n   |_____|  n+1   \(2 Up Phi)
!

Two states are associated with the down node, they correspond to the position and speed of the wall. As the wall don’t move these states are initialized to be 0, and the cells are stationnary cells, therefore these values remain 0.

 
! Down cells (wall)
! -----------------
eta_pos_wall = 0; eta_speed_wall = 0.;

set_dwn_eta
< var: eta_pos_wall,  fun: deta_pos_wall  = 0.;
  var: eta_speed_wall, fun: deta_speed_wall= 0.;
>;

There are 2 limiting transfers in the up node. They correspond with an open end and are therefore set to 0.

 
! limiting Transfers : dummy ones
! -------------------------------
set_Up_Phi
< var:ff_dummy_1, fun: f_dummy_1=0.;
  var:ff_dummy_2, fun: f_dummy_2=0.;
>;

Starting points

The cell node state values are initialized. They are in an array indexed by the inode variable. In the example the variable corresponding with position is eta_move and the variable corresponding with speed is eta_speed. Their initial values are set with the following mortran code

 
!---------------
! Initialisation
!---------------
;
do inode=1,n_node <eta_move(inode)=0.01; eta_speed(inode)=0.0;>;

If any transfer needs to be given a first-guess value, this is also done using inode as the node index.

Grid node equations

Each node is associated with an index inode. It allows to refer to the preceding node, with inode-1 and the following node inode+1. The node states are declared in set_node_Eta block and the transfers are in set_node_Phi blocks.

In the example, the cells are declared with

 
! node cells
! ----------
;
set_node_Eta
< var: eta_move(inode),  fun: deta_move(inode) = eta_speed(inode);
  var: eta_speed(inode),
  fun: deta_speed(inode) = rmassm1(inode)
                             *( - ff_spring(inode+1) + ff_spring(inode)
                               - ff_dump(inode+1)  + ff_dump(inode)
                              );
>;

Note that the inode is dummy in the var: definition and can as well be written as: var: eta_move(.).

The transfers are (ff_spring corresponds with springs and ff_dump with dumps):

 
!%%%%%%%%%%%%%%%%%%%%%%
! Transfer definition
!%%%%%%%%%%%%%%%%%%%%%%
! node transfers
! --------------
! convention de signe spring : comprime:= +
set_node_Phi
< var: ff_spring(.),
  fun:
   f_spring(inode)= -rk(inode)*(eta_move(inode) - eta_move(inode-1));
  var: ff_dump(.),
  fun:
   f_dump(inode)  = -rd(inode)*(eta_speed(inode) - eta_speed(inode-1));
>;

The limiting states and transfers are associated with the states or transfers with index inode+1 or inode-1 appearing in node cell and transfer equations (inode-1 for down limiting conditions and inode+1 for up limiting conditions) in their order of appearance. In our example, in the eta_speed state node equation ff_spring(inode+1) appears before ff_dump(inode+1) and is therefore associated with ff_dummy_1 while ff_dump(inode+1) is associated with the ff_dummy_2 limiting transfer, as ff_dummy_1 appears before ff_dummy_2 in the limiting up transfers definitions. Verification of the grid index coherence should be eased with the following help printed in the listing header:

 



  --------------- Informing on Dwn Eta definition ---------------
 Var-name,            Function-name, index in eta vector
         eta_pos_wall        deta_pos_wall  1 [
       eta_speed_wall      deta_speed_wall  2 [

  -------------- Informing on Eta Nodes definition --------------
 Var-name,     Function, k2index of (inode: 0 [ 1,...n_node ] n_node+1)
            eta_move           deta_move    1 [   3 ...   7 ]   9
           eta_speed          deta_speed    2 [   4 ...   8 ]  10

  ---------------- Informing on Up  Phi  definition -------------
 Var-name,             Function-name, index in ff vector
          ff_dummy_1           f_dummy_1 ]    7
          ff_dummy_2           f_dummy_2 ]    8
         ff_move_sum          f_move_sum ]    9
        ff_speed_sum         f_speed_sum ]   10
  ----------------------------------------------------

 -------------- Informing on Phi Nodes definition ---------------
 Var-name,     Function, k2index of (inode: 0 [ 1,...m_node ] m_node+1)
           ff_spring            f_spring   -1 [   1 ...   5 ]   7
             ff_dump              f_dump    0 [   2 ...   6 ]   8
  ----------------------------------------------------

All variable names and functions are free but has to be different. Any particular node-attached variable k is referred to as: ‘(inode:k)’, where k has to be a Fortran expression allowed in arguments. The symbol ‘inode’ is reserved. As usual other Fortran instructions can be written within the Mortran block ‘< >’ of each set_ block.


[Contents] [Index] [ ? ]

This document was generated by a tester on a sunny day using texi2html.