https://plmlab.math.cnrs.fr/cpierre1/cumin
Raw File
Tip revision: 4c687c5f43a16737698b758984c491a5a9dbe2b5 authored by Charles Pierre on 13 January 2023, 08:03:50 UTC
Add LICENSE
Tip revision: 4c687c5
feSpace_mod_expl.F90
!>
!!<B>      ASSEMBLE A FINITE ELEMENS SPACE \f$ X_h \f$
!!         of type \ref fespace_mod::fespace "feSpace"
!!
!!\li Construct a \ref fespace_mod::fespace "feSpace"
!!
!!\li visualise its DOFs
!!
!!\li visualise a function interpolated on \f$ X_h \f$
!!
!!@author Charles Pierre, 2020.
!>

program feSpace_mod_expl

  
  use cumin

  implicit none

  !! !!!!!!!!!!!!!!!!! VARAIBLE DEFINITION: BEGIN
  !!
  !! mesh_fic  = mesh file name
  !! msh       = mesh 
  !! Xh       = finite element space
  !!
  character(len=150) :: mesh_fic
  type(mesh)         :: msh
  type(feSpace)      :: Xh
  !!
  !! uh       = finite element function in Xh
  !!
  real(RP), dimension(:), allocatable :: uh
  !!
  !! !!!!!!!!!!!!!!!!! VARAIBLE DEFINITION: END

  write(*,*)
  write(*,*) message_1('feSpace_mod_expl',"")
  write(*,*)""
  call paragraph("ASSEMBLE AND VISUALIZE A FINITE ELEMENT SPACE")
  write(*,*) message_2("") , "VISUALISE A FINITE ELEMENT FUNSCTION"
  write(*,*) 



  !! !!!!!!!!!!!!!!!!!! MESH ASSEMBLING
  !!
  call paragraph("MESH ASSEMBLING")
  mesh_fic = trim(CUMIN_GMSH_DIR)//"testMeshes/disk2.msh"
  call mesh_create(msh, trim(mesh_fic), "gmsh", verb=2)
  call print(msh)

  !! !!!!!!!!!!!!!!!!!! FINITE ELEMENT SPACE Xh
  !!
  call paragraph("FINITE ELEMENT SPACE Xh")
  call feSpace_create(Xh, msh, "P2", verb=2)
  call print(Xh)


  !! !!!!!!!!!!!!!!!!!! VISUALISE THE FE SPACE Xh
  !!
  call paragraph("VISUALISE THE FE SPACE Xh")
  call visualise(Xh)


  !! !!!!!!!!!!!!!!!!!! VISUALISE A FUNCTION INTERPOLATED IN Xh
  !!
  call paragraph("VISUALISE A FUNCTION INTERPOLATED IN Xh")
  !!
  !!
  !! 1. Interpolate 'f' to the finite element function uh \in Xh
  call interpolate_scalFunc(uh, Xh, f, verb=2)
  !!
  !! 2. Visualise
  call FEFunc_visualise(uh, Xh, "scalFE")

  print*
  print*
  print*

contains

 function f(x)
    real(RP), dimension(3), intent(in) :: x
    real(RP) :: f

    f = sin(PI*x(1)) * sin(PI*x(2))

  end function f


  
end program feSpace_mod_expl
back to top