<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>COMSOL Blog &#187; Parameters, Variables, &amp; Functions</title>
	<atom:link href="http://www.comsol.se/blogs/category/general/parameters-variables-and-functions/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.comsol.se/blogs</link>
	<description></description>
	<lastBuildDate>Thu, 22 Nov 2018 09:33:42 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>	<item>
		<title>How to Use the Parameter Estimation Study Step for Inverse Modeling</title>
		<link>https://www.comsol.se/blogs/how-to-use-the-parameter-estimation-study-step-for-inverse-modeling/</link>
		<comments>https://www.comsol.se/blogs/how-to-use-the-parameter-estimation-study-step-for-inverse-modeling/#comments</comments>
		<pubDate>Thu, 29 Mar 2018 15:15:32 +0000</pubDate>
		<dc:creator><![CDATA[Amelia Halliday]]></dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Parameters, Variables, & Functions]]></category>
		<category><![CDATA[Optimization Module]]></category>
		<category><![CDATA[Technical Content]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://com.staging.comsol.com/blogs?p=254841</guid>
		<description><![CDATA[When creating a simulation, you usually start by building the forward model, supplying various inputs, and then looking at the results. However, what if you have a set of results and want to find the input values that provide the same outcome? Here, we show how to use the Parameter Estimation study step, which helps you build an inverse model and solve for the optimal values of your model inputs. Tutorial Video: Performing a Parameter Estimation Study in COMSOL Multiphysics® [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>When creating a simulation, you usually start by building the forward model, supplying various inputs, and then looking at the results. However, what if you have a set of results and want to find the input values that provide the same outcome? Here, we show how to use the <em>Parameter Estimation</em> study step, which helps you build an inverse model and solve for the optimal values of your model inputs.</p>
<p><span id="more-254841"></span></p>
<p id="video">
<h3>Tutorial Video: Performing a Parameter Estimation Study in COMSOL Multiphysics®</h3>
</p>
<p><script src="https://fast.wistia.com/assets/external/E-v1.js" async></script>
<div class="wistia_responsive_padding" style="padding:56.25% 0 0 0;position:relative;">
<div class="wistia_responsive_wrapper" style="height:100%;left:0;position:absolute;top:0;width:100%;">
<div class="wistia_embed wistia_async_gcolgitc5u seo=false videoFoam=true wmode=transparent" style="height:100%;position:relative;width:100%">&nbsp;</div>
</div>
</div>
<h3>Using the Parameter Estimation Study Step for Inverse Modeling</h3>
<p>Suppose that you have a set of external data (either from experimental measurements or a collection of reference data) that you want to model your simulation after. In this situation, you can use <em>inverse modeling</em>. As the name implies, inverse modeling is when you take a reverse modeling approach to your problem: Instead of solving for the outcome, you solve for the inputs. </p>
<p>To get the desired simulation results, there are several model inputs that you might want to investigate or experiment with, such as material properties. When solving for the values of these inputs, you are looking for the optimal values that provide you with the closest match between a set of external data and the simulation results. A natural approach is to minimize the sum of the squares of the differences between the data sets. As such, an efficient modeling strategy is to formulate the problem as a <a href="/blogs/multiparameter-optimization-with-a-least-squares-objective/">least-squares optimization problem</a>. To streamline the process of setting up and solving the problem, you can use the <em>Parameter Estimation</em> study step in the COMSOL Multiphysics® software. </p>
<blockquote><p>To use the <em>Parameter Estimation</em> study step, the study must be time dependent and a license for the Optimization Module is required. In addition, a set of reference data needs to be included through either an interpolation function or user-defined reference expression. Note that the reference data must either be time dependent or a function of a single argument.</p></blockquote>
<p><img src="https://cdn.comsol.com/wordpress/2018/03/parameter-estimation-settings-window-.png" title="" alt="A screenshot of the Parameter Estimation Settings window in COMSOL Multiphysics®." width="440" height="700" class="alignnone size-full wp-image-254881" /><br />
<em>The Settings window for the</em> Parameter Estimation <em>study step.</em></p>
<p>The <em>Parameter Estimation</em> study step is useful for a variety of inverse modeling problems &mdash; mainly parameter estimation. The objective is to estimate values for the desired model inputs (i.e., parameters), which provides insight into the ways that the values (and hence the properties themselves) affect the objective function.</p>
<p>Perhaps one of the most typical uses of this functionality is curve fitting or similar data-fitting applications. This process involves fitting a function to a series of data points. The fitting of the function is done by estimating the values for the coefficients used in the function, essentially fitting a parameterized analytic function to a collection of data. By fitting a curve to a set of data points, we can interpolate values from the function to areas where data isn&#8217;t explicitly available.</p>
<p>In the tutorial video at the <a href="#video">top of this blog post</a>, we demonstrate a parameter estimation via a modified version of the <a href="/model/various-analyses-of-an-elbow-bracket-4131">elbow bracket tutorial model</a>. Before computing this study, we need to properly define the problem&#8230;</p>
<h3>Performing a Parameter Estimation Study in COMSOL Multiphysics®</h3>
<p>Performing a parameter estimation study generally involves three major steps:</p>
<ol>
<li>Prestudy: preparing the definitions, such as the parameters, variables, and functions</li>
<li>Study setup: customizing various aspects of the study and computing it</li>
<li>Poststudy: postprocessing to visualize and compare the simulation and experimental results, as well as extracting the optimal values for the estimated model inputs</li>
</ol>
<p>Let’s look at how to complete these steps and the important factors to consider when setting up the <em>Parameter Estimation</em> study step in a model.</p>
<h4>Step 1: Preparing Definitions for a Parameter Estimation</h4>
<p>Before we perform a parameter estimation study, we must create the definitions needed to formulate the problem. This typically involves creating a combination of parameters, functions, and variables. First, we define the parameters of the model inputs for which we want an estimated value. Next, we include the external data by defining either a reference function or expression. Lastly, we define a variable that pulls and evaluates the output quantity from the simulation results, which are compared to the measured output data.</p>
<p>In the video above, we perform a time-dependent heat transfer analysis on the elbow bracket. The model data from the heat transfer simulation is then compared to the experimental data, which is used to estimate the value for the thermal conductivity of the material.</p>
<p>In the <em>Heat Transfer in Solids</em> node, the thermal conductivity is represented by <em>k</em>. Hence, we create a parameter named <em>k</em>, enter a rough estimate of its value, and use it in the appropriate node to define the thermal conductivity. </p>
<div class="row">
<div class="col-sm-6">
<a href="https://cdn.comsol.com/wordpress/2018/03/parameter-estimation-study-comsol-multiphysics.png" target="_blank"><img src="https://cdn.comsol.com/wordpress/2018/03/parameter-estimation-study-comsol-multiphysics.png" title="Parameters" alt="A screenshot of a table of parameters used in a parameter estimation study." class="alignnone size-full wp-image-254891" /></a>
</div>
<div class="col-sm-6">
<a href="https://cdn.comsol.com/wordpress/2018/03/heat-transfer-in-solids-node.png" target="_blank"><img src="https://cdn.comsol.com/wordpress/2018/03/heat-transfer-in-solids-node.png" title="Solid 1 node" alt="A screenshot of the Heat Transfer in Solids node in which the estimated material property is defined." class="alignnone size-full wp-image-254901" /></a>
</div>
</div>
<p><em>Left: The parameters used in the parameter estimation study, including the parameter</em> k <em>for estimating the thermal conductivity. Right: The node (named</em> Solid 1<em>) in which we use the parameter k to define the material property to be estimated.</em></p>
<p>Next, we create a definition so that we can implement the data from our external file into the COMSOL® software. In this case, the reference data is a collection of time-dependent temperature measurements contained in a comma-separated values (CSV) file. This data can be quickly and easily entered into COMSOL Multiphysics by adding an <em>Interpolation</em> function to our model component and then using the <em>Load from File</em> button. The data is automatically imported in a tabular format, with the first column containing the times and the second column containing the temperature measurements.</p>
<p><a href="https://cdn.comsol.com/wordpress/2018/03/Interpolation-function-comsol-software.png" target="_blank"><img src="https://cdn.comsol.com/wordpress/2018/03/Interpolation-function-comsol-software.png" title="Interpolation function and Load from File button" alt="A screenshot of the COMSOL Multiphysics® GUI with a plot of the imported reference data." width="1500" height="844" class="alignnone size-full wp-image-254911" /></a><br />
<em>The</em> Interpolation <em>function incorporates the reference data into the simulation. The</em> Load from File <em>button is used to import the external file into the function.</em></p>
<p>Under the <em>Units</em> section, we simply enter the respective units for the argument (time) and function (temperature). We do not need to be concerned with the options selected for the <em>Interpolation and Extrapolation</em> settings of the function, since the study only computes the differences at the times explicitly stated in the argument or <em>t</em> column of the function. Thus, the smoothing between data points and the behavior of the function outside of the range of the data is not relevant. </p>
<p>We now need to define an expression to extract the temperature quantity from the simulation results. (This quantity is later compared to the temperature measurements in the interpolation function.) The quantity we want to extract and use for comparison is the average temperature of the surface on the top-right end of the bracket.</p>
<p>Since we want to obtain the average of a quantity (temperature), we first add an <em>Average</em> component coupling under the <em>Definitions</em> node. We then select the geometry we want to obtain the average temperature for (i.e., the boundary on the top-right end of the elbow bracket). Note the tag in parentheses to the right of the <em>Average</em> component coupling, <em>aveop1</em>, as this will be used in the expression for defining our variable. </p>
<p><img src="https://cdn.comsol.com/wordpress/2018/03/elbow-bracket-geometry-comsol-ui.png" title="" alt="An image of the elbow bracket geometry with the Average component coupling highlighted." width="741" height="700" class="alignnone size-full wp-image-254921" /><br />
<em>The</em> Average <em>component coupling (highlighted in blue) helps us obtain the average value of a quantity on the selected geometry.</em> </p>
<p>To compare the computational and experimental results, we must define a variable to extract the quantity, and thus its value when computed, from the simulation results. Since we are looking at a specific part of the geometry, we define a local variable under the <em>Definitions</em> node or the <em>Definitions</em> ribbon tab. (A global variable is not suitable for our study, as the <em>Global Definitions</em> node is global in scope and defines, applies, or evaluates an expression over the entire model geometry.)</p>
<p>When defining the variable, we name it <em>Tave</em>, since we are looking to obtain the average (ave) temperature (T). For the expression, we can call out to the <em>Average</em> component coupling created earlier by entering <em>aveop1</em>. We then specify the quantity that we want the average of by entering the variable <em>T</em> (for temperature) in parentheses.</p>
<p><img src="https://cdn.comsol.com/wordpress/2018/03/variables-1-screenshot.png" title="" alt="A screenshot of the Settings window for the defined variable used for parameter estimation." width="956" height="525" class="alignnone size-full wp-image-254931" /><br />
<em>The defined variable, which is later used in the</em> Parameter Estimation <em>study step.</em> </p>
<h4>Step 2: Setting Up and Computing the Study</h4>
<p>Now we can add and set up the <em>Parameter Estimation</em> study step, for which several settings have already been handled. The reference data and study step selections are automatically linked to the interpolation function that contains the external data and the time-dependent study.</p>
<p>The expression entered in the <em>Model expression</em> field is evaluated and then compared to the external data at each time step specified in the reference function; i.e., each time in the argument column of the interpolation function. As such, this field is where we enter our local variable, <em>Tave</em>. </p>
<p>Notice that in the syntax of the <em>Model expression</em> field in the images below, we specify the location of our local variable, component 1, by including it before the variable name. The reason is that the scope of the <em>Parameter Estimation</em> study step is global. As a result, the study step does not &#8220;see&#8221; variables defined locally within a component unless we indicate their scope in the expression. For a global variable, we simply enter its name in the <em>Model expression</em> field. To enter the variable with its scope specified automatically, you can use the <em>Auto Completion</em> feature to select and enter the variable from the list of definitions.</p>
<div class="row">
<div class="col-sm-6">
<a href="https://cdn.comsol.com/wordpress/2018/03/comsol-multiphysics-auto-completion-feature-.png" target="_blank"><img src="https://cdn.comsol.com/wordpress/2018/03/comsol-multiphysics-auto-completion-feature-.png" title="Auto Completion feature" alt="A screenshot highlighting the use of the Auto Completion feature in COMSOL Multiphysics®." class="alignnone size-full wp-image-254941" /></a>
</div>
<div class="col-sm-6">
<a href="https://cdn.comsol.com/wordpress/2018/03/completed-parameter-estimation-study-step.png" target="_blank"><img src="https://cdn.comsol.com/wordpress/2018/03/completed-parameter-estimation-study-step.png" title="Parameter Estimation study step" alt="A screenshot of the completed Parameter Estimation study step settings." class="alignnone size-full wp-image-254951" /></a>
</div>
</div>
<p><em>Left: Using the</em> Auto Completion <em>feature to select the local variable defined earlier. Right: A screenshot of the completed setup for the</em> Parameter Estimation <em>study step.</em></p>
<p>Now we just need to identify the parameters we want to estimate and select the optimization method. We provide a rough estimate for the parameter under the <em>Initial value</em> column, add an upper and lower bound for the values that the parameter can take, and set the <em>Scale</em> value. Applying the appropriate scale is important, as it can significantly slow down the convergence of the optimization solver or stop it from converging altogether. Using the default value works for the elbow bracket example, but it might not always be suitable. (For more information, read the chapter on parameter estimation in the <em>Optimization Module User&#8217;s Guide</em>.)</p>
<p>Next, we want to select the appropriate optimization algorithm and compute it. The different methods apply to certain use cases, which are discussed in further detail in the video. Since the parameter we want to estimate controls the value of a material property &mdash; and we want to impose an upper and lower bound on the value &mdash; we use the SNOPT method.</p>
<h4>Step 3: Comparing Results and Extracting Input Values</h4>
<p>Once the model finishes solving, we need to perform some additional postprocessing. We can visualize and compare the two sets of data by plotting the results, and then we can extract the optimal values for the estimated model inputs. To see and compare both sets of data on a single plot, we add a new <em>1D Plot Group</em> and include two <em>Global</em> plots under it. One <em>Global</em> plot displays the simulation results, while the other displays the reference data. </p>
<p>Since our interpolation function is a collection of data points, we want it to appear as a point graph. To do so, we change the time selection of the data points so that they are only plotted at the times specified by the argument column of the function. Additionally, we adjust several of the settings in the <em>Coloring and Style</em> section to further distinguish the two sets of data.</p>
<p><a href="https://cdn.comsol.com/wordpress/2018/03/comsol-simulation-results-vs-experimental.png" target="_blank"><img src="https://cdn.comsol.com/wordpress/2018/03/comsol-simulation-results-vs-experimental.png" title="Comparing simulation and experimental results" alt="A screenshot of the Model Builder with the Graphics window showing simulation results compared to experimental data." width="1500" height="680" class="alignnone size-full wp-image-254961" /></a><br />
<em>Comparison of the simulation and experimental results. The highlighted sections in the Settings window need to be adjusted to display the experimental data as a point graph.</em> </p>
<p>This plot shows that the model results closely match the experimental data. We can now extract the optimal value for the thermal conductivity of the elbow bracket material. To do so, we add a <em>Global Evaluation</em> node under the <em>Results</em> tab (or under the <em>Derived Values</em> node). In the Settings window, all we need to do is update the <em>Time selection</em> option to <em>Last</em> so that we can evaluate the value in the last time step, since the thermal conductivity is independent of time.</p>
<p><img src="https://cdn.comsol.com/wordpress/2018/03/settings-window-global-evaluation-node.png" title="" alt="A screenshot of the Global Evaluation node Settings window." width="538" height="429" class="alignnone size-full wp-image-254971" /><br />
<em>The Settings window for the</em> Global Evaluation <em>node.</em> </p>
<p>After entering the parameter <em>k</em> in the <em>Expression</em> field, we click <em>Evaluate</em> and are provided with the optimal value for that parameter.</p>
<p><img src="https://cdn.comsol.com/wordpress/2018/03/thermal-conductivity-optimal-value-screenshot.png" title="" alt="A screenshot of a table with the optimal value for thermal conductivity in the elbow bracket." width="954" height="194" class="alignnone size-full wp-image-254981" /><br />
<em>The optimal value for the thermal conductivity.</em> </p>
<p>As shown above, a thermal conductivity of ~0.27 W/(m*K) provides the simulation temperature results that best match measurements from experimental data.</p>
<h3>Modeling in Reverse via the Parameter Estimation Study Step</h3>
<p>In COMSOL Multiphysics, the <em>Parameter Estimation</em> study step helps estimate the optimal values for the inputs of a simulation. By estimating the values that define various aspects of a model, you can investigate the parts of the problem that either hinder or help in best matching the computed results with a data set from an external file.</p>
<p>This functionality also enables you to solve other types of inverse modeling problems by streamlining and expediting the process of defining, setting up, and solving a least-squares optimization problem. For more details about this useful study step, <a href="#video">watch the tutorial video at the top of this post</a>, which provides guidance on how to use this functionality with a simple example.</p>
<h3>Additional Resources</h3>
<p>To learn more about parameter estimation in COMSOL Multiphysics, its use cases, and the various study step settings, read the chapters on parameter estimation in both the <em>Introduction to the Optimization Module</em> and <em>Optimization Module User&#8217;s Guide</em> documentation. </p>
<p>An <a href="/video/using-the-optimization-module-for-parameter-estimation">archived webinar on parameter estimation</a> is also available. (Note that the archived webinar uses the <em>Optimization</em> interface instead of the <em>Parameter Estimation</em> study step.)</p>
]]></content:encoded>
			<wfw:commentRss>https://www.comsol.se/blogs/how-to-use-the-parameter-estimation-study-step-for-inverse-modeling/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Radial Basis Functions for Surface Interpolation</title>
		<link>https://www.comsol.se/blogs/using-radial-basis-functions-for-surface-interpolation/</link>
		<comments>https://www.comsol.se/blogs/using-radial-basis-functions-for-surface-interpolation/#comments</comments>
		<pubDate>Tue, 08 Mar 2016 13:53:17 +0000</pubDate>
		<dc:creator><![CDATA[Walter Frei]]></dc:creator>
				<category><![CDATA[Application Builder]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Parameters, Variables, & Functions]]></category>
		<category><![CDATA[Technical Content]]></category>

		<guid isPermaLink="false">http://com.staging.comsol.com/blogs/?p=142021</guid>
		<description><![CDATA[Have you ever had a set of nonuniformly distributed points in a Cartesian plane that sample a surface height, such as points on the contours of a map or data points representing some material property data? If so, you probably also wanted to reconstruct, or interpolate, a continuous and smooth surface between these points. You can construct such a surface using the core capabilities of COMSOL Multiphysics by using Radial Basis Functions. Let&#8217;s find out how&#8230; An Introduction to Radial [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Have you ever had a set of nonuniformly distributed points in a Cartesian plane that sample a surface height, such as points on the contours of a map or data points representing some material property data? If so, you probably also wanted to reconstruct, or interpolate, a continuous and smooth surface between these points. You can construct such a surface using the core capabilities of COMSOL Multiphysics by using Radial Basis Functions. Let&#8217;s find out how&#8230;</p>
<p><span id="more-142021"></span></p>
<h3>An Introduction to Radial Basis Functions</h3>
<p>A single <a href="https://en.wikipedia.org/wiki/Radial_basis_function" target="_blank"><em>Radial Basis Function</em></a> (RBF) is any function defined in terms of distance (radius) from a point:</p>
<p class="latex-equation-number">(1)</p>
<div class="latex">z(x,y)=w \phi \left(\sqrt{(x-x_c)^2+(y-y_c)^2} \right) = w \phi ( || \mathbf {x- c}||) = w \phi(r)</div>
<p>where <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAMCAMAAABYzB2OAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TABF3iCKqmTPuRN3MZrtVqmprZQAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAABlSURBVAjXjY5JEsAgCARHwAU3/v/boIlVHsMBqIYZAH5GIBYvFBCivIjBCcgmkEKbZEVkX6prqhspxDIQ00KfENQ81b664z9cJyY3sunysjzyQc0Rl337hA7tM5FyuL5VN5KjegCm3gHKKIkz7gAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOC0xMS0yMlQwMDoxNzo1NiswMTowMJL97/cAAAAldE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4kC34zVy5SCAb9w6G2UnvLj2DpNC924iqfq2g8vkk/sdgtsDFBd7DsTqg/h+Wu3R82QAU0EmrmJJBl7Ul3DSwew2TOg9k/vk0inAm4c7o6eWTY5t3AArWyAcIC8jcFCJx2NmJr68dR5B7xsDKp0HeZYwJJABlgK18wOiMea1vfrS22rzyH1qlv+2/v7H+uv4wvrygnifXNWYgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOC0xMS0yMlQxMDozNToyMyswMTowMAuWQcMAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTgtMTEtMjJUMTA6MzU6MjMrMDE6MDB6y/l/AAAAIXRFWHRwczpIaVJlc0JvdW5kaW5nQm94ADU5eDE0KzI3Nis2MzYnO+LCAAAAJ3RFWHRwczpMZXZlbABBZG9iZUZvbnQtMS4wOiBDTUJYMTIgMDAzLjAwMgqB2uIdAAAASXRFWHRwczpTcG90Q29sb3ItMAAvZGV2L3NobS96ZjItY2FjaGUvMzcxODE1ZGI0ZDU1ZTQ3NzU3MGNmYjhhZDA0ODMxNTAuZHZpIC1vqkaI4QAAAEV0RVh0cHM6U3BvdENvbG9yLTEAL2Rldi9zaG0vemYyLWNhY2hlLzM3MTgxNWRiNGQ1NWU0Nzc1NzBjZmI4YWQwNDgzMTUwLnBz9eL2igAAAABJRU5ErkJggg==" /> are the coordinates of the point, or <em>center</em>; and <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAMBAMAAABPbPrXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAC1QTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////wISVsgAAAA10Uk5TADOIRBF33SLuVWa7ql+N64YAAAABYktHRACIBR1IAAAACXBIWXMAAAB4AAAAeACd9VpgAAAAN0lEQVQI12NgwASMSsxKDiAGK5tiRQCIMZF3gRNYxMAWpkgbxtgEY1yG0swXoAymA1AGC1gvAwBo8QczkHj6JwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOC0xMS0yMVQyMzo1OTo0MCswMTowMOb7hfMAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTgtMTEtMjFUMjM6NTk6NDArMDE6MDCXpj1PAAAAH3RFWHRwczpIaVJlc0JvdW5kaW5nQm94ADl4NyszMDErNjM5sXcjOgAAACd0RVh0cHM6TGV2ZWwAQWRvYmVGb250LTEuMDogQ01NSTEyIDAwMy4wMDIKMReWuwAAAEl0RVh0cHM6U3BvdENvbG9yLTAAL2Rldi9zaG0vemYyLWNhY2hlLzRiNDNiMGFlZTM1NjI0Y2Q5NWI5MTAxODliM2RjMjMxLmR2aSAtb6TeD18AAABFdEVYdHBzOlNwb3RDb2xvci0xAC9kZXYvc2htL3pmMi1jYWNoZS80YjQzYjBhZWUzNTYyNGNkOTViOTEwMTg5YjNkYzIzMS5wc6os9ZcAAAAASUVORK5CYII=" /> is the distance from any other point in the xy-plane to this center.</p>
<p>The RBF itself can be one of many different types of functions. The family of <a href="https://en.wikipedia.org/wiki/Polyharmonic_spline" target="_blank">polyharmonic splines</a> is often used for interpolation, particularly the <a href="https://en.wikipedia.org/wiki/Thin_plate_spline" target="_blank">thin-plate spline</a> function. The thin-plate spline basis function is:</p>
<p id="equation-2">
<p class="latex-equation-number">(2)</p>
<div class="latex">\phi(r)=r^2 \log (r)</div>
</p>
<p>Now, just a single one of these RBFs is not all that interesting, but we can take a sum over a finite number of different centers with different weights and optionally add a linear polynomial term with weights <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAARCAMAAACmcHF0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TACKIVTO7EUTd7pnMZneqmB59rAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAADmSURBVDjLzZJBEsMgCEURFdRqvf9tixqrJqYz3YUFSXj44U8EeGgoRK3Un2hHjCVgh7v2e7Qj5Fly5k37PdqS8JLEmQQjI+2RmDE3xCCG5tKXFbEQq4Bec/9AMa7zB6Ekkr5K1haLxXp5mUYPdHYyEc4dthWzhpjsOFdjoLPSTKROuc73YjJlMhq7knLp8NDRV6mjmYjNUB8xMBqrEYaSf8OKhtKBZgIc+h8tq0mfrkoR2teCJnd8IUbWXK8oOUmu1jZ3sStdUHGozVqLqLCuZC53MWIOuEXKZ4lzv+K2ZYLb+IGeFx+Y8AeY7bkFpwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOC0xMS0yMlQxMDozNToyMyswMTowMAuWQcMAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTgtMTEtMjJUMTA6MzU6MjMrMDE6MDB6y/l/AAAAIXRFWHRwczpIaVJlc0JvdW5kaW5nQm94ADQ0eDEwKzI4Mys2MzYAWFYAAAAAJ3RFWHRwczpMZXZlbABBZG9iZUZvbnQtMS4wOiBDTU1JMTIgMDAzLjAwMgoxF5a7AAAASXRFWHRwczpTcG90Q29sb3ItMAAvZGV2L3NobS96ZjItY2FjaGUvNDNjMjY2ZjRlMmJkNDU4MjEwNWYyNjRmYWYzMjA1OTkuZHZpIC1vHjeANgAAAEV0RVh0cHM6U3BvdENvbG9yLTEAL2Rldi9zaG0vemYyLWNhY2hlLzQzYzI2NmY0ZTJiZDQ1ODIxMDVmMjY0ZmFmMzIwNTk5LnBzqjM13gAAAABJRU5ErkJggg==" />, giving us the function: </p>
<p id="equation-3">
<p class="latex-equation-number">(3)</p>
<div class="latex">z(x,y)= \sum_{i=1}^N w_i \phi(r_i) + a_0 + a_1x + a_2y</div>
</p>
<p>If there are enough centers, then this sum of a set of RBFs can be used to represent very complicated <a href="https://en.wikipedia.org/wiki/Single-valued_function" target="_blank">single-valued functions</a>. When using the thin-plate spline basis, there is the added advantage that this function is also smooth everywhere and infinitely differentiable.</p>
<p>Let&#8217;s now take a look at how to interpolate a smooth surface with these RBFs. If we are given a finite set of center point locations, <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH8AAAAWCAMAAADemLOzAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TAEQzESJmiFWZd8y77t2qu/ZIIQAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAAH5SURBVEjH7VXblpswDJQs+YZv//+3lWRICKabZk/3qdUDGI+YkcY2APyP7wa6eSfk6xSA488JPwofMCaVyyGkzXRzQL9FHUUFf7QCzHotBFmlQ2WtSEdDRtzUge0n9RPqNSAUbZOGaHeVxiFA0kpgWvFT+sn0HYyiA72yl0Ee4kc1/ZL+jIpTK+W+2N9DOKRxJwrRjBiHVun6ZHOlzArfULm6kdAN+AgCP2rKx0OcioQp0L4GIl10mN5RleF1xxT4CAIKbWxHc1uYIhj0SBz6Kob0horHzLbxw60r5OSQvZwn10kE6sxPz5X2MnXot3sVCrpbIVf1Sj05EO+fSfACkTiNlc7WaDVu6/beaaPR6CIWH+u/UFkzRrV7dkZe9Z8QjgvIkxu1RTv3DNSNcMjUmPu/31Fp51QkAfeJpisjW4gX/ROE2tlpcXj/uEgZznK8SJiensRZyZZvqbRxrEf72lsjJaSHPre8QhDSGSrzixvBlWAhu8AE1HuzhdVkbnGlktzmH/qylWrqnZ/+c+0rhOkFou4RVbUOC3nRpYixWZs5EVuFXMtC5STXNzi7c11/XBCXdY3PkMvx+ofBHPc9ytnvo7BQmXBLDtY49JeXnNgY3T3f1+Hv9X29SQ1j/jnctX82l2+hN7F4xMGWiL76OeRvQX8l/x+LX2HtEIDiZ7LBAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTIyVDExOjUzOjI2KzAxOjAwYZMN5QAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0yMlQxMTo1MzoyNiswMTowMBDOtVkAAAAhdEVYdHBzOkhpUmVzQm91bmRpbmdCb3gANzZ4MTMrMjY3KzYzNqeuXyQAAAAndEVYdHBzOkxldmVsAEFkb2JlRm9udC0xLjA6IENNQlgxMiAwMDMuMDAyCoHa4h0AAABJdEVYdHBzOlNwb3RDb2xvci0wAC9kZXYvc2htL3pmMi1jYWNoZS9hNDJiYjIxNDllZDM1Njk5MWRmZmQ4NTZkZDQyZDNkYy5kdmkgLW9jgVadAAAARXRFWHRwczpTcG90Q29sb3ItMQAvZGV2L3NobS96ZjItY2FjaGUvYTQyYmIyMTQ5ZWQzNTY5OTFkZmZkODU2ZGQ0MmQzZGMucHNX0etfAAAAAElFTkSuQmCC" />, and their corresponding known heights, <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH0AAAAWCAMAAADabWOOAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TAEQzESJmiFWZd8y77t2qu/ZIIQAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAAHzSURBVEjH7VXJsuUgCBXFKQ78/982YHJjhuq8VL276mZhEY5yZDLG/JfXAnZVHODFZiy+dvhCfICYlCuHkJZVA79E0aKg3+OHLGtxTCnEoaJcSDRiDZtEv3yNPYGsgdciITpi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
<p class="latex-equation-number">(4)</p>
<div class="latex">\left[\begin{array}{cccccc}\phi_{1,1} &amp; \dots &amp; \phi_{1,N} &amp; 1 &amp; x_{c,1} &amp; y_{c,1}\\\vdots  &amp; \ddots &amp; \vdots &amp; &amp; \vdots &amp; \\\phi_{N,1}  &amp; \dots &amp; \phi_{N,N} &amp; 1 &amp; x_{c,N} &amp; y_{c,N}\\1 &amp; &amp; 1 &amp; 0 &amp; 0 &amp; 0 \\x_{c,1} &amp; \dots &amp; x_{c,N} &amp; 0 &amp; 0 &amp; 0 \\y_{c,1} &amp; &amp; y_{c,N} &amp; 0 &amp; 0 &amp; 0\end{array}\right]\left\{\begin{array}{c}w_1\\\vdots\\w_N\\a_0\\a_1\\a_2\end{array}\right\}= \left\{\begin{array}{c}z_1\\\vdots\\z_N\\\\end{array}\right\}</div>
</p>
<p>where the terms of the system matrix, <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKMAAAAZCAMAAABq426hAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TAGYziCJ3EUS7marMVe7dHza7DgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAAH7SURBVFjD7VfXcsMgEKSJpsL//22AUA4dqNnOZCbZBzw2d3srriAT8o9fBcr8wkVenqNyTBJHeSQtfaoprFrl5TkqhzT7PfaEOjtJu+N/h0ai+G5vekKYnYz6hEaid2XD79MVJzlj/ndoXHbZfkUj5Z/RSFawwSZubvdjdbIL4hdm03peTkmQXaOxPq/kk68saUcHwFQF6znNas/P1lkS5dzpcyK7RqMpXaJprH61DYg4RM/JIX7t/LbY9JlGbNdoLOF4sAjhfChhq7LDREEnrFE4V5JSKCVOB7RLEfsaN/o96EI4WYUteMwDQCesUYHYhVKAbKTfVKMxRuxrDGYh79wO9EydXDdOSCNrYo/RsetrXFUcImITfojk5l5oHUawZxR28oeKemZz8ZZcIGU3HcUuR2x7Jt+1QSwnUjNCBU+N5AvmuCerE+nNHuU2nzgxy0rZRbErEdvZw2o86pPoH0WSNRWh9znpyeIUiwHlidnVWCsA5SDbya5EHM1wme5bQkFbn108xSmcA9JYQC25CI5y3dyFWY9dqCALI+TKlQYe4uCdIlJewrcj5DDQs2ikvnhsPPPTKwJqFON3s0h5CW7PwWAqWTuuw7ezctw5UTrSeBkpIuAw40r2vbiVVr2K+F/BlOUuasTKMR00G/PvC/y1F6zb+PmIfw9fYuAReUOiFDQAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMjJUMTE6NTM6MjcrMDE6MDDH5AZRAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTIyVDExOjUzOjI3KzAxOjAwtrm+7QAAACF0RVh0cHM6SGlSZXNCb3VuZGluZ0JveAA5OHgxNSsyNTYrNjM15Z7zpAAAACd0RVh0cHM6TGV2ZWwAQWRvYmVGb250LTEuMDogQ01NSTEyIDAwMy4wMDIKMReWuwAAAEl0RVh0cHM6U3BvdENvbG9yLTAAL2Rldi9zaG0vemYyLWNhY2hlL2M2MmRlNzE1YjdkYTlmZGEyZWQ2NTBhMjBiM2EzYjJjLmR2aSAtb2tBMYwAAABFdEVYdHBzOlNwb3RDb2xvci0xAC9kZXYvc2htL3pmMi1jYWNoZS9jNjJkZTcxNWI3ZGE5ZmRhMmVkNjUwYTIwYjNhM2IyYy5wc8/5YwsAAAAASUVORK5CYII=" />, are the Radial Basis Functions evaluated between the centers.</p>
<p>Almost all of the off-diagonal terms will be nonzero when using the thin-plate spline basis, hence this system matrix is quite dense. The linear system can be solved for all of the weights and we can then evaluate the sum of our weighted RBFs at any other point in the xy-plane, giving us a smooth interpolation function. Let&#8217;s now look at how to compute these weights and visualize the interpolation function using the core capabilities of COMSOL Multiphysics.</p>
<h3>Surface Interpolation with Radial Basis Functions in COMSOL Multiphysics</h3>
<p>We start with a model containing a 3D component with a dimensionless units system. The units system is selected in the settings for <em>Component 1</em>. A dimensionless units system is simpler to use if our data represents material properties rather than a geometry.</p>
<p>The geometry in the model consists of two features. First, a <em>Point</em> feature is used to define the set of points. (The list of coordinates can be copied from a text file.) The <em>Cumulative Selection</em> is used to define a named selection of all of these points, as shown in the screenshot below. There is additionally a <em>Block</em> feature, which has dimensions that are slightly larger than the range of data points and is positioned to enclose all data points.</p>
<p><img src="https://cdn.comsol.com/wordpress/2016/03/Defining-data-points.png" title="" alt="Defining the data points for interpolation in COMSOL Multiphysics." width="554" height="352" class="alignnone size-full wp-image-142121" /><br />
<em>A screenshot showing the definition of the data points to interpolate and the cumulative selection definition.</em></p>
<p><img src="https://cdn.comsol.com/wordpress/2016/03/Data-points-and-bounding-block.png" title="" alt="A schematic showing the data points and the bounding block." width="673" height="418" class="alignnone size-full wp-image-142131" /><br />
<em>The data points and the bounding block.</em></p>
<p>Once the geometry is defined, we define an <em>Integration Component Coupling</em> operator over the points that we just created. Since the integration is done over a set of points, this operator is equivalent to taking a sum of an expression evaluated over the set of points. Next, we define three variables, as shown in the screenshot below.</p>
<p>First, the variable <code>r = eps+sqrt((dest(x)-x)^2+(dest(y)-y)^2)</code> will be used to compute the distances between all of the centers. Note the usage of the <code>dest()</code> operator, which forces the expression within the operator to be evaluated on the destination points instead of the source points. A very small nonzero term (<code > eps</code> is <a href="https://en.wikipedia.org/wiki/Machine_epsilon" target="_blank">machine epsilon</a>) is added so that this expression is never precisely zero.</p>
<p>Next, the variable <code>phi = r^2*log(r)</code> is Equation <a href="#equation-2">(2)</a>, the thin-plate spline basis function. Note that this function converges to zero for a radius of zero, but we did need to make the radius very slightly nonzero because of the log function so that the basis function can be evaluated at zero. It is also worth remarking that this function could be changed to any other desired basis function. </p>
<p>Lastly, the definition <code>RBF = intop1(w*phi)+a0+a1*x+a2*y</code> is Equation <a href="#equation-3">(3)</a>, the interpolated surface itself, with weights that are not yet computed. Keep in mind that the integration component coupling operator takes a sum of the expression within the operator over those points.</p>
<p><img src="https://cdn.comsol.com/wordpress/2016/03/Definitions-of-variables.png" title="" alt="Definitions of the variables." width="691" height="361" class="alignnone size-full wp-image-142141" /><br />
<em>A screenshot showing the definitions of the variables.</em></p>
<p>Now that the geometry is set up and all variables are defined, we are ready to solve for the weights for the RBF and the polynomial terms. This is done with a <em>Point ODEs and DAEs</em> interface, defined over the points that we want to interpolate, as shown in the screenshot below. We can set all of the units to dimensionless, since the point locations are also dimensionless. These settings define a set of unknowns, <code>w</code>, which will have a different value for each point.</p>
<p><img src="https://cdn.comsol.com/wordpress/2016/03/Settings-for-the-Point-ODEs-and-DAEs-interface.png" title="" alt="The settings for the Point ODEs and DAEs interface." width="522" height="495" class="alignnone size-full wp-image-142151" /><br />
<em>Settings for the </em>Point ODEs and DAEs<em> interface.</em></p>
<p>Within this physics interface, only two features need to be modified. Firstly, the settings for the <em>Distributed ODE</em> need to be adjusted as shown below. The <em>Source Term</em> is defined as <code>z-RBF</code>. Since all other terms in the equation are zero when a Stationary study is solved, this term means that <code > RBF=z</code> at all of the selected points. With this one feature, we define rows 1 through N of Equation <a href="#equation-4">(4)</a>.</p>
<p><img src="https://cdn.comsol.com/wordpress/2016/03/Source-Term-settings.png" title="" alt="A screenshot depicting the Source Term settings at each point." width="521" height="503" class="alignnone size-full wp-image-142161" /><br />
<em>The settings for the Source Term at each point.</em></p>
<p>Secondly, we need to define the last three rows of Equation <a href="#equation-4">(4)</a>. This is done with a <em>Global Equations</em> feature, as shown in the next screenshot. These three equations solve for the weights <code>a0</code>, <code>a1</code>, and <code > a2</code>. Again, the integration coupling operator takes a sum of the expression over all selected points. With these two features, the problem is completely defined and almost ready to solve.</p>
<p><img src="https://cdn.comsol.com/wordpress/2016/03/Global-Equations-for-polynomial-weights.png" title="" alt="Global Equations for the polynomial weights." width="523" height="363" class="alignnone size-full wp-image-142171" /><br />
<em>A screenshot showing the Global Equations for the polynomial weights.</em></p>
<p>Solving this model requires that we have a mesh on all points, so we apply a free tetrahedral mesh to the bounding box and then solve with a Stationary solver. Once the problem is solved, we can plot our interpolation function, the variable <code>RBF</code>, as shown below.</p>
<p><img src="https://cdn.comsol.com/wordpress/2016/03/Surface-interpolation.png" title="" alt="A simulation illustrating using Radial Basis Functions for surface interpolation." width="775" height="417" class="alignnone size-full wp-image-142181" /><br />
<em>The smooth and differentiable interpolation surface passes through all of the data points. </em></p>
<h3>Packaging the Functionality into a Simulation App</h3>
<p>If you would like to use this functionality without setting up all of these features in your own models, you are also welcome to download our demonstration app from our <a href="https://www.comsol.com/model/interpolation-between-points-using-a-comsol-app-34491">Application Gallery</a>, which takes in the <em>xyz</em> data points from a comma-delimited file and computes the interpolation surface. Up to 5000 data points can be interpolated with this demo app. </p>
<p>In addition to computing this surface, the app can write out the complete analytic function describing the surface, and also write out a COMSOL-format CAD file of the surface itself, all within the core capabilities of COMSOL Multiphysics. The CAD data is a <a href="https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline" target="_blank">NURBS surface</a> and thus only approximately represents the function, but to a very high accuracy for reasonably smooth surfaces. A screenshot of the app&#8217;s user interface is shown below.</p>
<p><img src="https://cdn.comsol.com/wordpress/2016/03/App-computing-an-interpolation-function.png" title="" alt="Screenshot of an app designed to compute an interpolation function." width="841" height="662" class="alignnone size-full wp-image-142191" /><br />
<em>Screenshot of an app that computes an interpolation function and writes out the function and CAD surface.</em></p>
<h3>Further Resources</h3>
<p>If you&#8217;re interested in finding out more about the Application Builder and COMSOL Server™, which can be used to build and run this app, check out the resources below.</p>
<ul>
<li>Read a complete rundown of instructions in the <a href="http://cdn.comsol.com/documentation/5.2.0.166/IntroductionToApplicationBuilder.pdf" target="_blank"><em>Introduction to Application Builder</em> manual</a></li>
<li>Watch these videos to learn about <a href="http://www.comsol.com/videos?workflow%5B%5D=workflowstep-appbuild&amp;sortOrder=&amp;s=">how to use the Application Builder and COMSOL Server™</a></li>
<li>Read these blog posts to <a href="http://www.comsol.com/blogs/category/all/applications/">see how simulation apps are used in a variety of applications</a></li>
</ul>
<p>What would you like to do with COMSOL Multiphysics? Do you have further questions about the capabilities of Radial Basis Functions? <a href="http://www.comsol.com/contact">Contact us</a> for help.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.comsol.se/blogs/using-radial-basis-functions-for-surface-interpolation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Accessing Nonlocal Variables with Linear Extrusion Operators</title>
		<link>https://www.comsol.se/blogs/accessing-non-local-variables-with-linear-extrusion-operators/</link>
		<comments>https://www.comsol.se/blogs/accessing-non-local-variables-with-linear-extrusion-operators/#comments</comments>
		<pubDate>Tue, 29 Sep 2015 21:08:54 +0000</pubDate>
		<dc:creator><![CDATA[Temesgen Kindo]]></dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Parameters, Variables, & Functions]]></category>
		<category><![CDATA[Technical Content]]></category>

		<guid isPermaLink="false">http://com.staging.comsol.com/blogs/?p=105861</guid>
		<description><![CDATA[In many simulation tasks, it is necessary to transfer variables from one region of a computation domain (the source) to another region or component (the destination). In COMSOL Multiphysics, this functionality is achieved by defining a point-to-point map, called an extrusion operator, that relates a set of destination points with a set of source points. Once a mapping is established by an extrusion operator, all variables defined at the source can be accessed from the destination using the same operator. [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>In many simulation tasks, it is necessary to transfer variables from one region of a computation domain (the source) to another region or component (the destination). In COMSOL Multiphysics, this functionality is achieved by defining a point-to-point map, called an <em>extrusion operator</em>, that relates a set of destination points with a set of source points. Once a mapping is established by an extrusion operator, all variables defined at the source can be accessed from the destination using the same operator.</p>
<p><span id="more-105861"></span></p>
<h3>Mapping Variables Between Regions</h3>
<p>There are many practical situations in which mapping variables from one component, or part of a component, to another is needed. One instance is the linking of two submodels, for example, the generation of inlet boundary conditions for turbulent flow models. The boundary conditions at the inlets significantly affect the flow in the domain. However, the flow profiles at the inlets are not as easily defined as with laminar flow. To generate turbulent inlet boundary conditions, an auxiliary model with normal inflow can be used. The resulting velocity profile at the outlet then needs to be copied to the inlet of the main model.</p>
<p>Efficiency can be another reason to map variables between regions. Consider <a href="http://www.comsol.com/multiphysics/thermal-expansion-and-thermal-stresses">thermal expansion</a> with axisymmetric thermal boundary conditions and material properties. If the structural boundary conditions are not axisymmetric, we can save time by performing an axisymmetric thermal analysis first, and then mapping the temperature from the 2D axisymmetric domain to the 3D domain for structural analysis.</p>
<p>Another common scenario is the implementation of periodic or other boundary conditions where a quantity at a point on a boundary is related to a quantity at a point on another boundary. For example, in a diode, the normal current density on one side of the p-n junction depends on the electric potential at the same point and the electric potential on the other side of the junction. While a variety of such boundary conditions are built into the appropriate physics interfaces in COMSOL Multiphysics, from time to time users may need to construct their own.</p>
<p>Such instances require point-wise mapping of variables from one domain or boundary to another. Today, we will show how these mappings can be constructed.</p>
<h3>Mapping Between Source and Destination</h3>
<p>The idea of a mapping involves two geometric entities: the source where a quantity is known and the destination where the quantity will be used. We know a quantity, <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAMAAADqmnyMAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TACKIVREzu0Tumcxmqt13qwCkfwAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAABuSURBVBjTlZDBEsMgCAXlIRCj1v//22KTtNKbHDjszO4wpLQ5BHBGZKI5mUZIh/keFmA5fdmI9jFFaGD2Ef+SNvKd5Mr81cltT1JL0h5Yi6HpvKLUXyDLlRT01xr2pHSvrpBnEsbrCSgK2n2Yzxth4QIceLcw1QAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOC0xMS0yMlQxMTo1MzoyNyswMTowMMfkBlEAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTgtMTEtMjJUMTE6NTM6MjcrMDE6MDC2ub7tAAAAIXRFWHRwczpIaVJlc0JvdW5kaW5nQm94ADEyeDEwKzI5OSs2MzZzpov3AAAAJ3RFWHRwczpMZXZlbABBZG9iZUZvbnQtMS4wOiBDTU1JMTIgMDAzLjAwMgoxF5a7AAAASXRFWHRwczpTcG90Q29sb3ItMAAvZGV2L3NobS96ZjItY2FjaGUvM2Q4MDc4NDgyMDcyYWI2OWU0NzhlMzFkMTUxOTlkOTMuZHZpIC1va4HwkQAAAEV0RVh0cHM6U3BvdENvbG9yLTEAL2Rldi9zaG0vemYyLWNhY2hlLzNkODA3ODQ4MjA3MmFiNjllNDc4ZTMxZDE1MTk5ZDkzLnBz80QEdAAAAABJRU5ErkJggg==" />, at the source and want to calculate another quantity, <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAARBAMAAAArn0GwAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADBQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////L2OGaQAAAA50Uk5TACKIVREzu0Tumcx3ZqpqOePkAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAAeAAAAHgAnfVaYAAAAHZJREFUCNdjYMAJGJVMFGDsMIcyGJuxnYGvgIGB1QHI5lzAUAek9oHYHAoMakAqCqSmroAhCUhtArMdGJ4z8JxOBrE5BJgeMCixPAGxeabrJjA+YV0ANtSVTYEngRtqBV8BzwQ2GwjbjoHluuZuMJNpmiIDXgAA1dkUb4ylTWsAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMjJUMTE6NTM6MjgrMDE6MDAxrHa4AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTIyVDExOjUzOjI4KzAxOjAwQPHOBAAAACF0RVh0cHM6SGlSZXNCb3VuZGluZ0JveAAxM3gxMCsyOTkrNjM26APHmAAAACd0RVh0cHM6TGV2ZWwAQWRvYmVGb250LTEuMDogQ01NSTEyIDAwMy4wMDIKMReWuwAAAEl0RVh0cHM6U3BvdENvbG9yLTAAL2Rldi9zaG0vemYyLWNhY2hlL2JjZDU5MzdkZTBmZmFmNWM0NDA5NWFjOGQzZTYzNjhlLmR2aSAtbzqbyc4AAABFdEVYdHBzOlNwb3RDb2xvci0xAC9kZXYvc2htL3pmMi1jYWNoZS9iY2Q1OTM3ZGUwZmZhZjVjNDQwOTVhYzhkM2U2MzY4ZS5wc4RjRpoAAAAASUVORK5CYII=" />, at the destination. The new quantity, <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAARBAMAAAArn0GwAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADBQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////L2OGaQAAAA50Uk5TACKIVREzu0Tumcx3ZqpqOePkAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAAeAAAAHgAnfVaYAAAAHZJREFUCNdjYMAJGJVMFGDsMIcyGJuxnYGvgIGB1QHI5lzAUAek9oHYHAoMakAqCqSmroAhCUhtArMdGJ4z8JxOBrE5BJgeMCixPAGxeabrJjA+YV0ANtSVTYEngRtqBV8BzwQ2GwjbjoHluuZuMJNpmiIDXgAA1dkUb4ylTWsAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMjJUMTE6NTM6MjgrMDE6MDAxrHa4AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTIyVDExOjUzOjI4KzAxOjAwQPH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WHRwczpMZXZlbABBZG9iZUZvbnQtMS4wOiBDTU1JMTIgMDAzLjAwMgoxF5a7AAAASXRFWHRwczpTcG90Q29sb3ItMAAvZGV2L3NobS96ZjItY2FjaGUvM2Q4MDc4NDgyMDcyYWI2OWU0NzhlMzFkMTUxOTlkOTMuZHZpIC1va4HwkQAAAEV0RVh0cHM6U3BvdENvbG9yLTEAL2Rldi9zaG0vemYyLWNhY2hlLzNkODA3ODQ4MjA3MmFiNjllNDc4ZTMxZDE1MTk5ZDkzLnBz80QEdAAAAABJRU5ErkJggg==" /> or a function of it.</p>
<p>We can break this problem down into these steps:</p>
<ol>
<li>Go to a point, <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAPBAMAAADjSHnWAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADBQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////L2OGaQAAAA50Uk5TABGIVXdmu5kz7syqRCLacKjxAAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAAeAAAAHgAnfVaYAAAAG5JREFUCNdjYMALhJRZVOEcRge2QrsGGI9FgE2hBUhzCIB4HAycBiDaTwAi2wemu6BqvcCkE5S3iUGEgTUkGcw+1ziJwZFBifEhmHfqUNvRBt6HHAsg9jUwHmBgTWBRQLiHtYDNFMFj3KPuguFkAAgVEjZ50ad3AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTIyVDExOjUzOjI4KzAxOjAwMax2uAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0yMlQxMTo1MzoyOCswMTowMEDxzgQAAAAgdEVYdHBzOkhpUmVzQm91bmRpbmdCb3gAMTV4OSsyOTgrNjM399ABdAAAACd0RVh0cHM6TGV2ZWwAQWRvYmVGb250LTEuMDogQ01NSTEyID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L2JjZDU5MzdkZTBmZmFmNWM0NDA5NWFjOGQzZTYzNjhlLmR2aSAtbzqbyc4AAABFdEVYdHBzOlNwb3RDb2xvci0xAC9kZXYvc2htL3pmMi1jYWNoZS9iY2Q1OTM3ZGUwZmZhZjVjNDQwOTVhYzhkM2U2MzY4ZS5wc4RjRpoAAAAASUVORK5CYII=" />.</li>
<li>Identify the source point, <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAPCAMAAADXs89aAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TABGIVXdmu5kz7syqRCLd4ADzxgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAABqSURBVBjTlZDhCoAgDIS328ypM9//bTOSwJKg/fw47jtG9PcYEFKEB1WiLbI0m7ByxyDTOX2GkqzarfEKa15uKbjMJEFGnTfjhMtcC1kZODts83Caa4r3eu6Afbix60the29/4woXfL3pABU8Ae8xm3PcAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTIyVDExOjUzOjI4KzAxOjAwMax2uAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0yMlQxMTo1MzoyOCswMTowMEDxzgQAAAAgdEVYdHBzOkhpUmVzQm91bmRpbmdCb3gAMTN4OSsyOTkrNjM3IgXihwAAACd0RVh0cHM6TGV2ZWwAQWRvYmVGb250LTEuMDogQ01NSTEyIDAwMy4wMDIKMReWuwAAAEl0RVh0cHM6U3BvdENvbG9yLTAAL2Rldi9zaG0vemYyLWNhY2hlL2YwZjlkNWFkNWU2OGJkY2MzNGQyOTU5YWE1ZDU1YmZhLmR2aSAtb1HIklMAAABFdEVYdHBzOlNwb3R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c8+B104AAAAASUVORK5CYII=" />. Let this coordinate transformation be given by <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGEAAAAXCAMAAAAso9FNAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TAGYzdxGIRJmqVSK73czu+4QQWwAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAAFgSURBVEjH7ZXbloMgDEW5JOEm8v9/OwgqSMEOrHmcPHS1ku7AOSEy9h8xuOg+lrDIAyzBjwckB4lqsYLUBMwEjGh1MECPMgnXKiSgDDZ+2gOhaJjq7EoBm5TRW9pkhIMf55olnXjyb0//pbhH/ibFfn+L7hkms3G/CRHuVG1eCO5SEGI3OAUmNG0nqMRjKduQwtMLQV1tdnSuQybatsM66oVsQ4rQJQg4AdfvQzIzYcZeLAw9ggxNhaTsxA2sbDgrNAThLxEqZXtNJwcqVTaUCjVB4mcFjdkuZri5T1s7Xd+ryga2UUvgXLoToc6zUhCwY7bLaiaGY6BjQ+7WmhD3DZdg7mwt8oTCURqRdldfbgVHH7Zy/CRIRbCRftlQbhzEFThPK3CTbCKsfxK4Kzb0poaICpupCu3k45HqTNZBdSafRTKTM9c+bQNNqKTMcsyRhsFHxqnVl9xniT9+i07HD7IvCQgyD6+jAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTIyVDExOjUzOjI4KzAxOjAwMax2uAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0yMlQxMTo1MzoyOCswMTowMEDxzgQAAAAhdEVYdHBzOkhpUmVzQm91bmRpbmdCb3gANTh4MTQrMjc2KzYzNryerq0AAAAndEVYdHBzOkxldmVsAEFkb2JlRm9ud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GRhdGU6bW9kaWZ5ADIwMTgtMTEtMjJUMTE6NTM6MjcrMDE6MDC2ub7tAAAAIXRFWHRwczpIaVJlc0JvdW5kaW5nQm94ADEyeDEwKzI5OSs2MzZzpov3AAAAJ3RFWHRwczpMZXZlbABBZG9iZUZvbnQtMS4wOiBDTU1JMTIgMDAzLjAwMgoxF5a7AAAASXRFWHRwczpTcG90Q29sb3ItMAAvZGV2L3NobS96ZjItY2FjaGUvM2Q4MDc4NDgyMDcyYWI2OWU0NzhlMzFkMTUxOTlkOTMuZHZpIC1va4HwkQAAAEV0RVh0cHM6U3BvdENvbG9yLTEAL2Rldi9zaG0vemYyLWNhY2hlLzNkODA3ODQ4MjA3MmFiNjllNDc4ZTMxZDE1MTk5ZDkzLnBz80QEdAAAAABJRU5ErkJggg==" /> as an argument to a function <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGIAAAAWCAMAAAAMyLnrAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TADOIZhHuqrvdRCKZVcx3l54RMAAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAAEiSURBVEjH3ZTRkoUgCIYFNANN3/9t1zq7FQ06nTPTxR7uyk9/flCc+7IARHpWwQc/xWclaHYsz0rg9KF7fxuN+JkEpJsgYU3IhyU4lgQx+4H+om30cagnkuuRGkTveGSR1NoAp3D+4l1PwuqtsutHOt11hYP2h50Lm5bNlf7JOpYJLLxULdErRUBDv6CKENnCYbkclU0F3jyPb1tCGy96l1T72fFmdt2YKdtZZLRwohI1n1W3ZS67uyaNrbYyObAfp7q0fzii83XUbQl7ZpQY19klIdlDUj+9X1za8ddWxOI64eFVW8DZZLw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XgAA1dkUb4ylTWsAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMjJUMTE6NTM6MjgrMDE6MDAxrHa4AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTIyVDExOjUzOjI4KzAxOjAwQPHOBAAAACF0RVh0cHM6SGlSZXNCb3VuZGluZ0JveAAxM3gxMCsyOTkrNjM26APHmAAAACd0RVh0cHM6TGV2ZWwAQWRvYmVGb250LTEuMDogQ01NSTEyIDAwMy4wMDIKMReWuwAAAEl0RVh0cHM6U3BvdENvbG9yLTAAL2Rldi9zaG0vemYyLWNhY2hlL2JjZDU5MzdkZTBmZmFmNWM0NDA5NWFjOGQzZTYzNjhlLmR2aSAtbzqbyc4AAABFdEVYdHBzOlNwb3RDb2xvci0xAC9kZXYvc2htL3pmMi1jYWNoZS9iY2Q1OTM3ZGUwZmZhZjVjNDQwOTVhYzhkM2U2MzY4ZS5wc4RjRpoAAAAASUVORK5CYII=" />.</li>
</ol>
<p>We end up with</p>
<div class="latex">q_d(x_d) = f(q_s(T(x_d))).</div>
<p>The focus of this blog post is on the transformation <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGwAAAAUCAMAAABfyShTAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TABGIZneqRFWZIt3uM8y7fOfgQwAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAAEvSURBVEjH3VXBroQgDCwFCkiB///bx2IURFhXEy9vDkYj0ykzJQD8YwiskG+LKU0CTEIAsvZtMV0Uk8tPhy9ruWKdXj5PoodFhPhtnSzrfDGQ3EMxvuM/p240kGvXiAbUxeyEdmsXjDWyCkp7q0IBRCtMYvgC2aR9xVgja9X2TlV+iwisNhPG8di6j57Rw889/7TnTePBJkZHBM1jxqlg+poIp7obDrssHuAjjRk9+sj636F5nxxFizNGj1Nk3W9cUwcpVRz7Y3DMMNL0hFNkbtnSpcTC45o6IoiJP83otwyngXVbTmJICx47c377pkDIkWRO3WUhHvvTHuqGkeuUKa3lLiAySZTsZZxGJtyQkbvARV0pDCFz+9HcuYU4z4J5JiY0oVV3uA7JvH2RzPAHcYYH3PXaqHIAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMjJUMTE6NTM6MjkrMDE6MDCX230MAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTIyVDExOjUzOjI5KzAxOjAw5obFsAAAACF0RVh0cHM6SGlSZXNCb3VuZGluZ0JveAA2NXgxMisyNzMrNjM3UwYF4QAAACd0RVh0cHM6TGV2ZWwAQWRvYmVGb250LTEuMDogQ01NSTEyIDAwMy4wMDIKMReWuwAAAEl0RVh0cHM6U3BvdENvbG9yLTAAL2Rldi9zaG0vemYyLWNhY2hlLzk2MGNjNGUxYjEzZjE1YTc0ZmU2NWE1YTQ4ZjM0YWUxLmR2aSAtb2Fnks8AAABFdEVYdHBzOlNwb3RDb2xvci0xAC9kZXYvc2htL3pmMi1jYWNoZS85NjBjYzRlMWIxM2YxNWE3NGZlNjVhNWE0OGYzNGFlMS5wcwg7KkgAAAAASUVORK5CYII=" /></p>
<p>COMSOL Multiphysics offers two coupling operators to specify this mapping: <em>Linear Extrusion</em> operators and <em>General Extrusion</em> operators. Linear Extrusion operators are easier to build, but their utility is limited to <a href="https://en.wikipedia.org/wiki/Affine_transformation" target="_blank">affine transformations</a>. General Extrusion operators are more general but take more work to define.</p>
<p>Here, we will discuss Linear Extrusion operators. In a later blog post, we will deal with General Extrusion operators.</p>
<h3>Using Linear Extrusion Operators in COMSOL Multiphysics</h3>
<p>When the source and destination points are related to each other by affine transformations such as translation, scaling, reflection, rotation, or shear, COMSOL Multiphysics provides a simple way of specifying the extrusion operator: the Linear Extrusion operator. To add a Linear Extrusion operator, we go to <em>Definitions&gt;Component Couplings&gt;Linear Extrusion</em>.</p>
<p>The basic idea of a Linear Extrusion operator is that an affine transformation between two lines can be defined if we know two corresponding pairs of points on the lines. Similarly, three pairs of noncollinear points and four pairs of nonplanar (with no more than two collinear) points are enough to describe affine mappings of 2D and 3D domains, respectively.</p>
<p>This is similar to linear system analysis in general. If we know the transformation of a sufficient number of base points/vectors, we can transform every point/vector using linear superposition. Think of the Linear Extrusion operator as a visual way of picking the basis and their transformations. From that information, COMSOL Multiphysics automatically derives the mapping that needs to be applied on an arbitrary point/vector.</p>
<p>We will illustrate this with a few examples.</p>
<h4>Example 1</h4>
<p>The first operator is used for mapping data from the line segment with ends 1 and 4 to the line segment with ends 4 and 5, with the orientation preserved. All we need to do is indicate to COMSOL Multiphysics which point goes where, as shown in the image below.</p>
<p><img src="https://cdn.comsol.com/wordpress/2015/09/Linear-Extrusion-operator-in-COMSOL-Multiphysics.png" title="" alt="An example of using the Linear Extrusion operator in COMSOL Multiphysics." width="1000" height="702" class="alignnone size-full wp-image-105961" /><br />
<em>A Linear Extrusion operator matching points 1 and 4 in the source to points 4 and 5 in the destination, respectively.</em> </p>
<p>Note that even though we are in a 2D space, we are working with 1D objects (lines). Thus, it suffices to indicate the correspondence between two sets of vertices. What if we choose 5 for <em>Destination vertex 1</em>  and 4 for <em>Destination vertex 2</em>? In that case, in addition to the translation and stretching needed to take segment 1-4 to segment 4-5, there will be a flipping. See the plot below.</p>
<p><img src="https://cdn.comsol.com/wordpress/2015/09/Plot-for-linear-extrusion.png" title="" alt="A plot depicting the order of vertices." width="1000" height="592" class="alignnone size-full wp-image-105971" /><br />
<em>The order of vertices under Source Vertices and Destination Vertices of a Linear Extrusion operator determines the orientation of the mapping.</em></p>
<h4>Example 2</h4>
<p>Now, let&#8217;s increase the dimension of our objects and build the Linear Extrusion operator to copy data from the interior circle to the outer domain by radially stretching. All we need to do is to add one more pair of vertices to the above vertex pairing. See the Linear Extrusion settings window below.</p>
<p><img src="https://cdn.comsol.com/wordpress/2015/09/Linear-extrusion-settings-window.png" title="" alt="The settings window for a Linear Extrusion operator." width="1000" height="702" class="alignnone size-full wp-image-105991" /><br />
<em>The higher the dimension of objects in the mapping, the more vertices in the geometry need to be paired up to define a Linear Extrusion operator.</em></p>
<p>The mapping matches points 1, 4, and 2 in the source domain to points 1, 5, and 3 in the destination domain, respectively. If we want to look at this in terms of basis vectors, segment 1-4 in the source corresponds to segment 1-5 in the destination. Similarly, segment 1-2 in the source corresponds to segment 1-3 in the destination. From these two linearly independent bases, COMSOL Multiphysics gets enough information to construct the mapping that takes any destination point in the 2D domain to a source point. The figure below shows how a variable <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWBAMAAAAyb6E1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADBQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////L2OGaQAAAA50Uk5TAGYzRHeImSIRqrvd7lXG7hx8AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAAeAAAAHgAnfVaYAAAAFxJREFUCNdjYMANGBFMZQTTAcEMwMJkck0tgLA4Qlg4JkOYXAIsDNYQZhQDC4MdhLkRaCyU+RhobCSEeZghgH07hBnKENClAGGyBoaGw6xoM4Bby8qAjamLx1MMACb0C664ONS1AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTIxVDIzOjQ2OjI1KzAxOjAwQiknngAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0yMVQyMzo0NjoyNSswMTowMDN0nyIAAAAhdEVYdHBzOkhpUmVzQm91bmRpbmdCb3gAMTJ4MTMrMzAwKzYzNsZDjz8AAAAndEVYdHBzOkxldmVsAEFkb2JlRm9udC0xLjA6IENNTUkxMiAwMDMuMDAyCjEXlrsAAABJdEVYdHBzOlNwb3RDb2xvci0wAC9kZXYvc2htL3pmMi1jYWNoZS8xZWQzNDY5MzA5MTc0MjZiYzQ2ZDQxZTIyY2M1MjVlYy5kdmkgLW8VWa1hAAAARXRFWHRwczpTcG90Q29sb3ItMQAvZGV2L3NobS96ZjItY2FjaGUvMWVkMzQ2OTMwOTE3NDI2YmM0NmQ0MWUyMmNjNTI1ZWMucHNJcIBrAAAAAElFTkSuQmCC" /> defined on the interior circle is mapped by the Linear Extrusion operator <em>linext2</em> that we just defined.</p>
<p><img src="https://cdn.comsol.com/wordpress/2015/09/Variable-defined-and-mapped.png" title="" alt="A variable is defined and mapped." width="793" height="407" class="alignnone size-full wp-image-106001" /><br />
<em>A variable defined over interior circle (left) and mapped to all points using the Linear Extrusion operator (right).</em></p>
<h3>Evaluating Quantities</h3>
<p>What we have done up to now is build the infrastructure that will help us access variables. Now, let&#8217;s see how to use the tool we built.</p>
<p>If we look at any of the Linear Extrusion settings windows shown in the images above, we see <em>Operator name</em> at the top. That name is what we will use to access the mapping. If <em>linext2</em> was the name of the extrusion operator, any time we are at a destination point and want to refer to a quantity, say <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAMCAMAAACz+6aNAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TABF3iCJVRJndZjOqzLvuR/KZegAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAABXSURBVAjXjY1LDsAgCERH0PHbev/bltRo6K6zgPAS3gC/EkSjrcRDFJptlbpBI7oCccZNaEcDanEiGTZyduTSj8Zyp6WRQ4r16kQ6atRO4aC4t8C3c+UBhLQBckIuz94AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMjJUMDE6MDY6MjMrMDE6MDA52qQyAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTIyVDAxOjA2OjIzKzAxOjAwSIccjgAAACB0RVh0cHM6SGlSZXNCb3VuZGluZ0JveAAxMHg3KzMwMSs2MzkllWOuAAAAJ3RFWHRwczpMZXZlbABBZG9iZUZvbnQtMS4wOiBDTU1JMTIgMDAzLjAwMgoxF5a7AAAASXRFWHRwczpTcG90Q29sb3ItMAAvZGV2L3NobS96ZjItY2FjaGUvN2I3NzRlZmZlNGEzNDljNmRkODJhZDRmNGYyMWQzNGMuZHZpIC1v3PTzLQAAAEV0RVh0cHM6U3BvdENvbG9yLTEAL2Rldi9zaG0vemYyLWNhY2hlLzdiNzc0ZWZmZTRhMzQ5YzZkZDgyYWQ0ZjRmMjFkMzRjLnBz7A4ZmQAAAABJRU5ErkJggg==" />, from the corresponding source point, we use the expression <em>linext2(u)</em>. If we want the variable <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAMCAMAAABYzB2OAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TABF3iCKqmTPuRN3MZrtVqmprZQAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAABlSURBVAjXjY5JEsAgCARHwAU3/v/boIlVHsMBqIYZAH5GIBYvFBCivIjBCcgmkEKbZEVkX6prqhspxDIQ00KfENQ81b664z9cJyY3sunysjzyQc0Rl337hA7tM5FyuL5VN5KjegCm3gHKKIkz7gAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOC0xMS0yMlQwMDoxNzo1NiswMTowMJL97/cAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTgtMTEtMjJUMDA6MTc6NTYrMDE6MDDjoFdLAAAAIHRFWHRwczpIaVJlc0JvdW5kaW5nQm94ADExeDcrMzAwKzYzOdl7ld4AAAAndEVYdHBzOkxldmVsAEFkb2JlRm9udC0xLjA6IENNTUkxMiAwMDMuMDAyCjEXlrsAAABJdEVYdHBzOlNwb3RDb2xvci0wAC9kZXYvc2htL3pmMi1jYWNoZS9mMTI5MDE4NmE1ZDBiMWNlYWIyN2Y0ZTc3YzBjNWQ2OC5kdmkgLW/a6goDAAAARXRFWHRwczpTcG90Q29sb3ItMQAvZGV2L3NobS96ZjItY2FjaGUvZjEyOTAxODZhNWQwYjFjZWFiMjdmNGU3N2MwYzVkNjgucHOj7rhnAAAAAElFTkSuQmCC" /> from the same source point, we use <em>linext2(w)</em>. This explains why we call them operators. Once we build them, we can use them with any legitimate argument.</p>
<p>Instead of just using a variable, if we want a function of the variable, we can put the function either inside the operator or apply the function to the output of the operator. For example, <em>linext2(w^2)</em> is equivalent to <em>linext2(w)^2</em>. Does <em>linext2(w)+u</em> return the same value as <em>linext2(w+u)</em>? Generally, no. In the first case, <em>u</em> at a destination point is added to <em>w</em> evaluated at the corresponding source point. In the second case, both <em>u</em> and <em>w</em> are evaluated at the source point. The image below illustrates this point using the Linear Extrusion operator from Example 2.</p>
<p><img src="https://cdn.comsol.com/wordpress/2015/09/Applying-an-extrusion-operator.png" title="" alt="Applying the Linear Extrusion operator." width="696" height="329" class="alignnone size-full wp-image-106011" /><br />
<em>The variable <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWBAMAAAAyb6E1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADBQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////L2OGaQAAAA50Uk5TAGYzRHeImSIRqrvd7lXG7hx8AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAAeAAAAHgAnfVaYAAAAFxJREFUCNdjYMANGBFMZQTTAcEMwMJkck0tgLA4Qlg4JkOYXAIsDNYQZhQDC4MdhLkRaCyU+RhobCSEeZghgH07hBnKENClAGGyBoaGw6xoM4Bby8qAjamLx1MMACb0C664ONS1AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTIxVDIzOjQ2OjI1KzAxOjAwQiknngAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0yMVQyMzo0NjoyNSswMTowMDN0nyIAAAAhdEVYdHBzOkhpUmVzQm91bmRpbmdCb3gAMTJ4MTMrMzAwKzYzNsZDjz8AAAAndEVYdHBzOkxldmVsAEFkb2JlRm9udC0xLjA6IENNTUkxMiAwMDMuMDAyCjEXlrsAAABJdEVYdHBzOlNwb3RDb2xvci0wAC9kZXYvc2htL3pmMi1jYWNoZS8xZWQzNDY5MzA5MTc0MjZiYzQ2ZDQxZTIyY2M1MjVlYy5kdmkgLW8VWa1hAAAARXRFWHRwczpTcG90Q29sb3ItMQAvZGV2L3NobS96ZjItY2FjaGUvMWVkMzQ2OTMwOTE3NDI2YmM0NmQ0MWUyMmNjNTI1ZWMucHNJcIBrAAAAAElFTkSuQmCC" /> is evaluated at the destination in the inner circle and at the source in the outer arc (left). All evaluations are at the source (right). Note that in general, the argument, such as <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWBAMAAAAyb6E1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADBQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////L2OGaQAAAA50Uk5TAGYzRHeImSIRqrvd7lXG7hx8AAAAAWJLR0QAiAUdSAAAAAlwSFlzAAAAeAAAAHgAnfVaYAAAAFxJREFUCNdjYMANGBFMZQTTAcEMwMJkck0tgLA4Qlg4JkOYXAIsDNYQZhQDC4MdhLkRaCyU+RhobCSEeZghgH07hBnKENClAGGyBoaGw6xoM4Bby8qAjamLx1MMACb0C664ONS1AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTExLTIxVDIzOjQ2OjI1KzAxOjAwQiknngAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0xMS0yMVQyMzo0NjoyNSswMTowMDN0nyIAAAAhdEVYdHBzOkhpUmVzQm91bmRpbmdCb3gAMTJ4MTMrMzAwKzYzNsZDjz8AAAAndEVYdHBzOkxldmVsAEFkb2JlRm9udC0xLjA6IENNTUkxMiAwMDMuMDAyCjEXlrsAAABJdEVYdHBzOlNwb3RDb2xvci0wAC9kZXYvc2htL3pmMi1jYWNoZS8xZWQzNDY5MzA5MTc0MjZiYzQ2ZDQxZTIyY2M1MjVlYy5kdmkgLW8VWa1hAAAARXRFWHRwczpTcG90Q29sb3ItMQAvZGV2L3NobS96ZjItY2FjaGUvMWVkMzQ2OTMwOTE3NDI2YmM0NmQ0MWUyMmNjNTI1ZWMucHNJcIBrAAAAAElFTkSuQmCC" />, can be a valid quantity at a destination point. In such cases, its value is generally different from the value returned by the extrusion operator. </em></p>
<p>Finally, when using an extrusion operator to map variables between different components, the operator should be added to the <em>Definitions</em> node of the component containing the source object. That component&#8217;s tag should be used when we use the operator in another component. To access a variable <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAMCAMAAACz+6aNAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TABF3iCJVRJndZjOqzLvuR/KZegAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAABXSURBVAjXjY1LDsAgCERH0PHbev/bltRo6K6zgPAS3gC/EkSjrcRDFJptlbpBI7oCccZNaEcDanEiGTZyduTSj8Zyp6WRQ4r16kQ6atRO4aC4t8C3c+UBhLQBckIuz94AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMjJUMDE6MDY6MjMrMDE6MDA52qQyAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTIyVDAxOjA2OjIzKzAxOjAwSIccjgAAACB0RVh0cHM6SGlSZXNCb3VuZGluZ0JveAAxMHg3KzMwMSs2MzkllWOuAAAAJ3RFWHRwczpMZXZlbABBZG9iZUZvbnQtMS4wOiBDTU1JMTIgMDAzLjAwMgoxF5a7AAAASXRFWHRwczpTcG90Q29sb3ItMAAvZGV2L3NobS96ZjItY2FjaGUvN2I3NzRlZmZlNGEzNDljNmRkODJhZDRmNGYyMWQzNGMuZHZpIC1v3PTzLQAAAEV0RVh0cHM6U3BvdENvbG9yLTEAL2Rldi9zaG0vemYyLWNhY2hlLzdiNzc0ZWZmZTRhMzQ5YzZkZDgyYWQ0ZjRmMjFkMzRjLnBz7A4ZmQAAAABJRU5ErkJggg==" /> defined in <em>component 1</em> from <em>component 2</em> using the Linear Extrusion operator <em>linext2</em>, the correct syntax is <em>comp1.linext2(comp1.u)</em>. This avoids confusion if there is an extrusion or another operator also called <em>linext2</em> or another variable called <img class="latexImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAMCAMAAACz+6aNAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAADNQTFRF////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////8T5qHgAAAA90Uk5TABF3iCJVRJndZjOqzLvuR/KZegAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAHgAAAB4AJ31WmAAAABXSURBVAjXjY1LDsAgCERH0PHbev/bltRo6K6zgPAS3gC/EkSjrcRDFJptlbpBI7oCccZNaEcDanEiGTZyduTSj8Zyp6WRQ4r16kQ6atRO4aC4t8C3c+UBhLQBckIuz94AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMTEtMjJUMDE6MDY6MjMrMDE6MDA52qQyAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTExLTIyVDAxOjA2OjIzKzAxOjAwSIccjgAAACB0RVh0cHM6SGlSZXNCb3VuZGluZ0JveAAxMHg3KzMwMSs2MzkllWOuAAAAJ3RFWHRwczpMZXZlbABBZG9iZUZvbnQtMS4wOiBDTU1JMTIgMDAzLjAwMgoxF5a7AAAASXRFWHRwczpTcG90Q29sb3ItMAAvZGV2L3NobS96ZjItY2FjaGUvN2I3NzRlZmZlNGEzNDljNmRkODJhZDRmNGYyMWQzNGMuZHZpIC1v3PTzLQAAAEV0RVh0cHM6U3BvdENvbG9yLTEAL2Rldi9zaG0vemYyLWNhY2hlLzdiNzc0ZWZmZTRhMzQ5YzZkZDgyYWQ0ZjRmMjFkMzRjLnBz7A4ZmQAAAABJRU5ErkJggg==" /> in the second component.</p>
<h3>Closing Remarks</h3>
<p>The focus of this blog post is the construction of Linear Extrusion operators. For their use in a full modeling problem, please see the <a href="https://www.comsol.com/model/turbulent-flow-over-a-backward-facing-step-228">simulation of the backward facing step</a>. In this example, a Linear Extrusion operator was used to transfer accurate inlet velocity from an auxiliary analysis in a turbulent flow simulation.</p>
<p>Stay tuned for our upcoming blog post on how to build General Extrusion operators, where we will illustrate their use in a full modeling example. In the meantime, please feel free to <a href="http://www.comsol.com/contact">contact us</a> if you have any questions.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.comsol.se/blogs/accessing-non-local-variables-with-linear-extrusion-operators/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
