/*****************************************************************************1*2* Elmer, A Finite Element Software for Multiphysical Problems3*4* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU General Public License8* as published by the Free Software Foundation; either version 29* of the License, or (at your option) any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with this program (in file fem/GPL-2); if not, write to the18* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,19* Boston, MA 02110-1301, USA.20*21*****************************************************************************/2223/*******************************************************************************24*25* Definition of two node bar 1D element.26*27*******************************************************************************28*29* Author: Juha Ruokolainen30*31* Address: CSC - IT Center for Science Ltd.32* Keilaranta 14, P.O. BOX 40533* 02101 Espoo, Finland34* Tel. +358 0 457 272335* Telefax: +358 0 457 230236* EMail: [email protected]37*38* Date: 20 Sep 199539*40*41* Modification history:42*43* 28 Sep 1995, changed call to elm_triangle_normal to geo_triangle normal44* routine elm_... doesn't exist anymore45*46******************************************************************************/4748#include "../elmerpost.h"49#include <elements.h>5051/*52* Two node 1D element53*54* o---------o u55* 0 156*57*/5859static double NodeU[2] = { 0.0, 1.0 };6061/*******************************************************************************62*63* Name: elm_2node_bar_triangulate( geometry_t *,element_t * )64*65* Purpose: Triangulate an element. The process also builds up an edge66* table and adds new nodes to node table. The triangulation67* and edge table is stored in geometry_t *geom-structure.68*69* Parameters:70*71* Input: (geometry_t *) pointer to structure holding triangulation72* (element_t *) element to triangulate73*74* Output: (geometry_t *) structure is modified75*76* Return value: FALSE if malloc() fails, TRUE otherwise77*78******************************************************************************/79int elm_2node_bar_triangulate( geometry_t *geom, element_t *Elm, element_t *Parent)80{8182int geo_add_edge();83return geo_add_edge( geom, Elm->Topology[0],Elm->Topology[1],Parent );84}8586/*******************************************************************************87*88* Name: elm_2node_bar_fvalue( double *,double,double )89*90* Purpose: return value of a quantity given on nodes at point (u)91*92*93* Parameters:94*95* Input: (double *) quantity values at nodes96* (double u) point where value is evaluated97*98* Output: none99*100* Return value: quantity value101*102******************************************************************************/103static double elm_2node_bar_fvalue(double *F,double u)104{105return F[0]*(1-u) + F[1]*u;106}107108/*******************************************************************************109*110* Name: elm_2node_bar_dndu_fvalue( double *,double,double )111*112* Purpose: return value of a first partial derivate in (u) of a113* quantity given on nodes at point (u)114*115*116* Parameters:117*118* Input: (double *) quantity values at nodes119* (double u) point where value is evaluated120*121* Output: none122*123* Return value: quantity value124*125******************************************************************************/126static double elm_2node_bar_dndu_fvalue(double *F,double u)127{128return -F[0] + F[1];129}130131/*******************************************************************************132*133* Name: elm_2node_bar_initialize()134*135* Purpose: Register the element type136*137* Parameters:138*139* Input: (char *) description of the element140* (int) numeric code for the element141*142* Output: Global list of element types is modified143*144* Return value: malloc() success145*146******************************************************************************/147int elm_2node_bar_initialize()148{149static char *Name = "ELM_2NODE_LINE";150151element_type_t ElementDef;152int elm_add_element_type();153154ElementDef.ElementName = Name;155ElementDef.ElementCode = 202;156157ElementDef.NumberOfNodes = 2;158159ElementDef.NodeU = NodeU;160ElementDef.NodeV = NULL;161ElementDef.NodeW = NULL;162163ElementDef.PartialU = (double (*)())elm_2node_bar_dndu_fvalue;164ElementDef.PartialV = (double (*)())NULL;165ElementDef.PartialW = (double (*)())NULL;166167ElementDef.FunctionValue = (double (*)())elm_2node_bar_fvalue;168ElementDef.Triangulate = (int (*)())elm_2node_bar_triangulate;169ElementDef.IsoLine = (int (*)())NULL;170ElementDef.PointInside = (int (*)())NULL;171ElementDef.IsoSurface = (int (*)())NULL;172173return elm_add_element_type( &ElementDef ) ;174}175176177