Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding dielectrics and thin gaps #84

Merged
merged 25 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/run_tests_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ IF "%VS_VER%"=="2017_build_tools" (
for /f "tokens=* usebackq" %%f in (`dir /b "C:\Program Files (x86)\Intel\oneAPI\compiler\" ^| findstr /V latest ^| sort`) do @set "LATEST_VERSION=%%f"
@call "C:\Program Files (x86)\Intel\oneAPI\compiler\%LATEST_VERSION%\env\vars.bat"

build\bin\fdtd_tests.exe
python -m pytest test
9 changes: 7 additions & 2 deletions .github/workflows/windows-intelLLVM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ jobs:
run: |
python -m pip install -r requirements.txt

- name: Run all tests
- name: Run unit tests
shell: bash
timeout-minutes: 120
timeout-minutes: 10
run: build/bin/fdtd_tests.exe

- name: Run system tests
shell: bash
timeout-minutes: 30
run: |
.github/workflows/run_tests_windows.bat
53 changes: 32 additions & 21 deletions doc/smbjson.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The following entries are shared by several FDTD-JSON objects and have a common

+ `type` followed by a string, indicates the type of JSON object that. Some examples of types are `planewave` for `sources` objects, and `polyline` for `elements`.
+ `id` is a unique integer identifier for objects that belong to a list and which can be referenced by other objects. For instance, an element in the `elements` list must contain a `id` which can be referenced by a source in `sources` through its list of `elementIds`.
+ `[name]` is an optional entry which is used to make the FDTD-JSON input human-readable, helping to identify inputs and outputs.
+ `[name]` is an optional entry which is used to make the FDTD-JSON input human-readable, helping to identify inputs and outputs. Leading and trailing blank spaces are removed. Blank spaces are substituted by underscroes. The following characters are reserved and can't be used in a `name`: `@`.

### `<general>`

Expand Down Expand Up @@ -85,12 +85,13 @@ These objects must contain a `<type>` label which can be:

+ `pec` for perfectly electric conducting termination.
+ `pmc` for perfectly magnetic conducting termination.
+ `periodic` for periodic boundary conditions. Must be paired with the opposite side.
+ `mur` for Mur's first order absorbing boundary condition.
+ `pml` for perfectly matched layer termination. If this `type` is selected, it must also contain:

+ `[layers]`: with an integer indicating the number of pml layers which will be used. TODO Change to an optional input which defaults to 10 layers
+ `[order]`: TODO Change to an optional input which defaults to order 2.
+ `[reflection]`: TODO Change to an optional input which defaults to 0.001 refl.
+ `[layers]`: with an integer indicating the number of pml layers which will be used. Defaults to $10$ layers
+ `[order]`: an integer indicating the order of the profile. defaults to order $2$.
+ `[reflection]`: Computed reflection coefficient, defaults to $0.001$.

**Example:**

Expand Down Expand Up @@ -253,9 +254,9 @@ These materials represent a perfectly electrically conducting (`pec`) and perfec
"materials": [ {"id": 1, "type": "pec"} ]
```

#### `simple`
#### `isotropic`

A `material` with `type` `simple` represents an isotropic material with constant (not frequency dependent) relative permittivity $\varepsilon_r$, relative permeability $\mu_r$, electric conductivity $\sigma$ and/or magnetic conductivity $\sigma_m$:
A `material` with `type` `isotropic` represents an isotropic material with constant (not frequency dependent) relative permittivity $\varepsilon_r$, relative permeability $\mu_r$, electric conductivity $\sigma$ and/or magnetic conductivity $\sigma_m$:

+ `[relativePermittivity]` is a real which defaults to $1.0$. Must be greater than $1.0$.
+ `[relativePermeability]` is a real which defaults to $1.0$. Must be greater than $1.0$.
Expand All @@ -268,7 +269,7 @@ A `material` with `type` `simple` represents an isotropic material with constant
{
"name": "teflon"
"id": 1,
"type": "simple",
"type": "isotropic",
"relativePermittivity": 2.5,
"electricConducitivity": 1e-6
}
Expand All @@ -280,7 +281,7 @@ In surface materials, `elementIds` must reference `cell` elements. All `interval

#### `multilayeredSurface`

A `multilayeredSurface` must contain the entry `<layers>` which is an array indicating materials which are described in the same way as [simple materials](#simple) and a `<thickness>`.
A `multilayeredSurface` must contain the entry `<layers>` which is an array indicating materials which are described in the same way as [isotropic materials](#isotropic) and a `<thickness>`.

```json
{
Expand All @@ -289,22 +290,26 @@ A `multilayeredSurface` must contain the entry `<layers>` which is an array indi
"id": 2,
"layers": [
{"thickness": 1e-3, "relativePermittivity": 1.3, "electricConductivity": 2e-4},
{"thickness": 5e-3, "relativePermittivity": 1.3}
{"thickness": 5e-3, "relativePermittivity": 1.3},
{"thickness": 1e-3, "relativePermittivity": 1.3, "electricConductivity": 2e-4}
]
}
```

#### `frequencyDependentSurface`
### Line materials

The entry `<file>` is the path to a file containing the poles and residues which are used to model the surface impedance of the material.
In line materials, `elementIds` must reference `cell` elements. All `intervals` modeling entities different to lines are ignored.

#### `thinSlot`

A `thinSlot` represents a gap between two conductive surfaces. Therefore it must be located at a surface and be defined using line cell elements only. Its `<width>` is a real number which defines the distance between the surfaces in meters.

```json
{
"name": "carbon_fiber_model",
"type": "frequencyDependentSurface",
"id": 3,
"file": "cfc.dat"
"name": "3mm-gap",
"type": "thinSlot",
"id": 2,
"width": 3e-3
}
```

Expand Down Expand Up @@ -469,7 +474,7 @@ This entry stores associations between `materials` and `elements` using their re

### `bulk`

Bulk materials such as `pec`, `pmc` or `simple` can be assigned to one or many elements of type `cell`. If the `cell` contains `intervals` representing points, these will be ignored.
Bulk materials such as `pec`, `pmc` or `isotropic` can be assigned to one or many elements of type `cell`. If the `cell` contains `intervals` representing points, these will be ignored.

```json
"materialAssociations": [
Expand All @@ -488,6 +493,16 @@ Surface materials can only be assigned to elements of type `cell`. If the `cell`
]
```

### `line`

Line materials can only be assigned to elements of type `cell`. If the `cell` contains `intervals` representing entities different to segments these will be ignored.

```json
"materialAssociations": [
{"type": "line", "materialId": 2, "elementIds": [4]}
]
```

### `cable`

This object establishes the relationship between the physical models described in a `material` and parts of the geometry. Besides a `type`, `materialId` and `elementIds`; a `cable` can contain the following inputs:
Expand Down Expand Up @@ -579,8 +594,6 @@ Performs a loop integral along on the contour of the surface reference in the `e

Due to Ampere's law, the loop integral of the magnetic field is equal to the total electric current passing through the surfaces. `[field]`, can be `electric` or `magnetic`. Defaults to `electric`, which gives the total current passing through the surface.

TODO REVIEW DO BULK CURRENTS DO AVERAGES OF MAGNETIC FIELDS IN CELLS NEXT TO THE SELECTED?

In the following example `elementId` points an element describing a single oriented surface, therefore `direction` does not need to be stated explicitly.

```json
Expand All @@ -602,8 +615,6 @@ In this example `elementId` points to a volume element, therefore `direction` mu
}
```

TODO EXAMPLE IMAGE

#### `farField`

Probes of type `farField` perform a near to far field transformation of the electric and magnetic vector fields and are typically located in the scattered field region which is defined by a total/scatterd field excitation, e.g. [a planewave](#planewave).
Expand Down Expand Up @@ -649,7 +660,7 @@ An example follows:

### `[domain]`

If `domain` is not specified, it defaults to record from the beginning to the end of the simulation.
If `domain` is not specified, it defaults to a time domain recording from the beginning to the end of the simulation.
The domain must specify a `<type>` from the following ones:

+ `time`, means recording only in time domain. A probe with a `domain` of this `type` can contain the following entries:
Expand Down
16 changes: 13 additions & 3 deletions src_json_parser/idchildtable.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module idchildtable_mod
type(fhash_tbl_t) :: idToChilds
contains
procedure :: getId
procedure :: count
procedure :: totalSize
procedure :: checkId
end type

interface IdChildTable_t
Expand Down Expand Up @@ -42,9 +43,17 @@ function ctor(core, root, path) result(res)
end do
end function

integer function count(this)
function totalSize(this) result(res)
class(IdChildTable_t) :: this
call this%idToChilds%stats(num_items=count)
integer :: res
call this%idToChilds%stats(num_items=res)
end function

function checkId(this, id) result(stat)
class(IdChildTable_t) :: this
integer, intent(in) :: id
integer :: stat
call this%idToChilds%check_key(key(id), stat)
end function

function getId(this, id) result(res)
Expand All @@ -66,5 +75,6 @@ function getId(this, id) result(res)
res = d
end select
end function

#endif
end module
17 changes: 13 additions & 4 deletions src_json_parser/mesh.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ module mesh_mod
contains
procedure :: addCoordinate => mesh_addCoordinate
procedure :: getCoordinate => mesh_getCoordinate
procedure :: checkId => mesh_checkId
procedure :: checkCoordinateId => mesh_checkCoordinateId
procedure :: checkElementId => mesh_checkElementId

procedure :: addElement => mesh_addElement
procedure :: addCellRegion => mesh_addCellRegion
Expand Down Expand Up @@ -86,12 +87,20 @@ subroutine mesh_printCoordHashInfo(this)

end subroutine

subroutine mesh_checkId(this, id, stat)
function mesh_checkCoordinateId(this, id) result(stat)
class(mesh_t) :: this
integer, intent(in) :: id
integer, intent(inout) :: stat
integer :: stat
call this%coordinates%check_key(key(id), stat)
end subroutine
end function


function mesh_checkElementId(this, id) result(stat)
class(mesh_t) :: this
integer, intent(in) :: id
integer :: stat
call this%elements%check_key(key(id), stat)
end function

subroutine mesh_addCoordinate(this, id, coordinate)
class(mesh_t) :: this
Expand Down
Loading
Loading