Skip to content

Commit

Permalink
First Prototype of Elmer adapter for preCICE with test scenarios (#1)
Browse files Browse the repository at this point in the history
* Provide two example cases inside adapter
* Only supports explicit coupling and no checkpointing
* See Thesis "Elmer adapter for preCICE" by Hisham Saeed for details (https://mediatum.ub.tum.de/doc/1636717/7e30s7hdtwhadpuzkb00xdm2l.pdf)

Co-authored-by: Benjamin Rodenberg <[email protected]>
  • Loading branch information
HishamSaeed and BenjaminRodenberg committed Feb 7, 2022
1 parent 9000d18 commit 76aadb9
Show file tree
Hide file tree
Showing 33 changed files with 9,555 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# ignoring mesh Files
*.boundary
*.elements
*.header
*.nodes
*.names
*.prof

# ignoring binary files
*.out
*.so
*.mod

# ignoring precice log files
*events-summary.log
*events.json

# ignoring specific sif file
entities.sif
venv

# ignoring results directory
Results/
build/
out/

# ignoring a (potentially added) FEniCS case
Partitioned_Heat_Conduction/fenics

# ignoring precice run directory
*/precice-run
476 changes: 476 additions & 0 deletions Adapter/Coupler_Solver.F90

Large diffs are not rendered by default.

424 changes: 424 additions & 0 deletions Adapter/Print_Module.F90

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions Adapter/UDF_Boundary.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
!-------------------------------
! Inlet Boundary condition v
! velocity in x-direction
!------------------------------


Function SetFlux(model,n, dummy_argument) RESULT(HeatFlux)

USE DefUtils

IMPLICIT None

TYPE(Model_t) :: model
INTEGER :: n
REAL(KIND=dp) :: dummy_argument,HeatFlux
REAL(KIND=dp) :: x,y
REAL(KIND=dp), dimension (10) :: Flux

CHARACTER(LEN=MAX_NAME_LEN) :: MaskName = "Coupler Interface"
TYPE(Mesh_t), POINTER :: mesh
TYPE(Solver_t),Pointer :: Solver
INTEGER, POINTER :: BCPerm(:)
INTEGER :: vertexSize
LOGICAL :: Visited = .FALSE.

SAVE Visited,BCPerm

Solver => model % Solver
Mesh => Solver % Mesh


x = model % Nodes % x(n)
y = model % Nodes % y(n)

! Flux = (/-2.104,-2.307,-2.388,-2.439,-2.458,-2.450,-2.4133,-2.339,-2.202,-2.008/)
Flux = (/-2.008,-2.202,-2.339,-2.4133,-2.450,-2.458,-2.439,-2.388,-2.307,-2.104/)



IF(.NOT. Visited) THEN

NULLIFY( BCPerm )
ALLOCATE( BCPerm( Mesh % NumberOfNodes ) )
BCPerm = 0

CALL MakePermUsingMask( Model, Solver, Mesh, MaskName, .TRUE., &
BCPerm, vertexSize )
Visited = .TRUE.
END IF

! HeatFlux = Flux(BCPerm(n))
HeatFlux = -1.9
!Print *,HeatFlux,n,BCPerm(n),Flux(BCPerm(n))

! LOGICAL :: Visited = .FALSE.

! INTEGER :: vertexSize
! INTEGER, POINTER :: BCPerm(:)
! TYPE(Mesh_t), POINTER :: mesh
! TYPE(Solver_t) :: Solver
! CHARACTER(LEN=MAX_NAME_LEN) :: maskName

! SAVE Visited,BCPerm

! IF (.NOT. Visited) THEN

! maskName = 'Coupler Interface'

! Solver = model % Solver
! Mesh => Solver % Mesh

! NULLIFY( BCPerm )
! ALLOCATE( BCPerm( Mesh % NumberOfNodes ) )
! BCPerm = 0
! ! CALL MakePermUsingMask( Model, Solver, Mesh, MaskName, .FALSE., &
! ! BCPerm, vertexSize )
! CALL MakePermUsingMask( Model, Solver, Mesh, MaskName, .TRUE., &
! BCPerm, vertexSize )
! CALL Info('CouplerSolver','Number of nodes at interface:'//TRIM(I2S(vertexSize)))
! Visited = .TRUE.
! END IF

! vertecies = (/1.3683,-2.8982,-1.1475,-0.5913,-0.3677,-0.2596,-0.2236,-0.2578,-0.4033,-0.9204,-0.5099/)

! ! Print *, n,BCPerm(n)

! tempLoads = vertecies(BCPerm(n))


END FUNCTION SetFlux
3 changes: 3 additions & 0 deletions Adapter/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
elmerf90 -o Coupler_Solver.so Coupler_Solver.F90 /usr/lib/x86_64-linux-gnu/libprecice.so.2
elmerf90 -o Print_Module.so Print_Module.F90 /usr/lib/x86_64-linux-gnu/libprecice.so.2
elmerf90 -o UDF_Boundary.so UDF_Boundary.F90 /usr/lib/x86_64-linux-gnu/libprecice.so.2
Loading

0 comments on commit 76aadb9

Please sign in to comment.