/*****************************************************************************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 3 node bar 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-----o u55* 0 0.5 156*57*/5859static double NodeU[] = { 0.0, 1.0, 0.5 };6061/*******************************************************************************62*63* Name: elm_3node_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_3node_bar_triangulate( geometry_t *geom, element_t *Elm, element_t *Parent)80{81int geo_add_edge();82geo_add_edge( geom, Elm->Topology[0],Elm->Topology[2],Parent );83return geo_add_edge( geom, Elm->Topology[2],Elm->Topology[1],Parent );84}8586/*******************************************************************************87*88* Name: elm_3node_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_3node_bar_fvalue(double *F,double u)104{105double u2=u*u;106107return F[0]*(1-3*u-2*u2) + F[1]*(-4*u+2*u2) + F[2]*(4*u+4*u2);108}109110/*******************************************************************************111*112* Name: elm_3node_bar_dndu_fvalue( double *,double,double )113*114* Purpose: return value of a first partial derivate in (u) of a115* quantity given on nodes at point (u)116*117*118* Parameters:119*120* Input: (double *) quantity values at nodes121* (double u) point where value is evaluated122*123* Output: none124*125* Return value: quantity value126*127******************************************************************************/128static double elm_3node_bar_dndu_fvalue(double *F,double u)129{130return F[0]*(-3-4*u) + F[1]*(-4+4*u) + F[2]*(4+8*u);131}132133/*******************************************************************************134*135* Name: elm_3node_bar_initialize()136*137* Purpose: Register the element type138*139* Parameters:140*141* Input: (char *) description of the element142* (int) numeric code for the element143*144* Output: Global list of element types is modified145*146* Return value: malloc() success147*148******************************************************************************/149int elm_3node_bar_initialize()150{151static char *Name = "ELM_3NODE_LINE";152153element_type_t ElementDef;154int elm_add_element_type();155156ElementDef.ElementName = Name;157ElementDef.ElementCode = 203;158159ElementDef.NumberOfNodes = 3;160161ElementDef.NodeU = NodeU;162ElementDef.NodeV = NULL;163ElementDef.NodeW = NULL;164165ElementDef.PartialU = (double (*)())elm_3node_bar_dndu_fvalue;166ElementDef.PartialV = (double (*)())NULL;167ElementDef.PartialW = (double (*)())NULL;168169ElementDef.FunctionValue = (double (*)())elm_3node_bar_fvalue;170ElementDef.Triangulate = (int (*)())elm_3node_bar_triangulate;171ElementDef.IsoLine = (int (*)())NULL;172ElementDef.PointInside = (int (*)())NULL;173ElementDef.IsoSurface = (int (*)())NULL;174175return elm_add_element_type( &ElementDef ) ;176}177178179