{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Field normalisation\n", "\n", "Apart from setting the value of a field, it is sometimes necessary to normalise it to a certain value. Also sometimes in the case of vector fields, it is required to set the value of certain points in the mesh to be zero. This can be achieved using `discretisedfield.Field.norm`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import discretisedfield as df\n", "\n", "p1 = (-50, -50, -50)\n", "p2 = (50, 50, 50)\n", "cell = (5, 5, 5)\n", "mesh = df.Mesh(p1=p1, p2=p2, cell=cell)\n", "\n", "value = (1, 1, 1)\n", "field = df.Field(mesh, nvdim=3, value=value)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Asking for a norm of the field returns a scalar field with norm values." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Field\n", "